I am trying to make a script that changes a bool value inside every player to false if another bool value, which is inside the Replicated Storage is true. If that value is false then the bool value inside every player will become true, but it doesn't work. What is the problem here?
And also in the output it doesn't show anything related to this script.
Here is the script:
local repstorage = game.ReplicatedStorage local round = repstorage.RoundInProgress.RoundInProgress local Players = game:GetService("Players") if round.Value == true then wait(0.5) for i,v in pairs(Players:GetChildren()) do v.ChangeTeam.Value = false end elseif round.Value == false then wait(0.5) for i,v in pairs(Players:GetChildren()) do v.ChangeTeam.Value = true end end
Thanks!
Your script is only checking the value of "round" when the game starts. In order to check the value whenever it is changed, you should use connect a function to when "round" is changed. Here's an example.
local repstorage = game.ReplicatedStorage local round = repstorage.RoundInProgress.RoundInProgress local Players = game:GetService("Players") round.Changed:Connect(function() if round.Value == true then wait(0.5) for i,v in pairs(Players:GetChildren()) do v.ChangeTeam.Value = false end elseif round.Value == false then wait(0.5) for i,v in pairs(Players:GetChildren()) do v.ChangeTeam.Value = true end end end)