Hi I have a module script with a variable “Worker” inside of it that starts out as nil, but when I set the player to it(worker = player) it doesn’t change. ‘Cause when I print it it says nil
ModuleScript:
local workModule = {
["Worker"] = nil
}
return workModule
Set script:
local button = script.Parent
local house = workspace.House
local moduleTable = require(workspace.Part.ModuleScript)
local remoteEvent = game.ReplicatedStorage.RemoteEvent
local buttonModule = require(game.ReplicatedStorage.ButtonModule)
local workersGUI = game.ReplicatedStorage.WorkersGUI
button.Touched:Connect(function(plr)
if (plr.Parent:WaitForChild("Humanoid")) then
local player = plr.Parent
moduleTable.Worker = player
workersGUI:FireAllClients()
buttonModule.SwitchOn(button)
buttonModule.Player = player
end
end)
I tried to look at my other code as an example of setting a modulescript variable to the player but it didn’t help. I don’t know why it works for other modulescripts but not this one