This is my script. It is part of a revolutionary new checkout system that will be put into my new store game that will be part of my store group. What it is supposed to do is this: When "Yes" is clicked on a GUI, the StringValue in the Workspace (WorkerValue) becomes the name of the player who clicked it. However, it will not do so if a BoolValue in the Workspace equals true because that would mean that there is already someone working at that register. It does not work. There are no output errors, it plain old doesn't work. Why? Here is the script:
script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.Visible = false if game.Workspace.Value == true then script.Parent.Parent.Visible = true elseif game.Workspace.Value == false then for _, Player in pairs(game.Players:GetPlayers()) do game.Workspace.Value = true game.Workspace.WorkerValue = Player.Name end end end)
To alter the value of the BoolValue in workspace, you actually have to find the value (you can't just go game.Workspace.Value and expect it to know what value you are talking about). Also, when setting the WorkerValue value, you have to use .Value instead of just getting the instance:
script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.Visible = false if game.Workspace["BoolValueNameHere"].Value == true then script.Parent.Parent.Visible = true elseif game.Workspace["BoolValueNameHere"].Value == false then for _, Player in pairs(game.Players:GetPlayers()) do game.Workspace["BoolValueNameHere"].Value = true game.Workspace.WorkerValue.Value = Player.Name end end end)
Keep in mind, if you are using FilteringEnabled any server scripts will not be able to see any changes done to values through local scripts.