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.Parentlocal house = workspace.Houselocal moduleTable = require(workspace.Part.ModuleScript)local remoteEvent = game.ReplicatedStorage.RemoteEventlocal buttonModule = require(game.ReplicatedStorage.ButtonModule)local workersGUI = game.ReplicatedStorage.WorkersGUIbutton.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 endend)
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