Hi. So my script is meant to check how many players there are. For testing purposes, I made it so if it is less than 1, then the scripts dont run and a boolValue is set to false. However, the BoolValue isn’t changing when there is 1 or more players. I’m not really sure what’s wrong, here’s the script.
local ss = game.ServerScriptService
local rsr = game.ReplicatedStorage.Round
while wait() do
playerCount = #game.Players:GetPlayers()
end
game.Players.PlayerAdded:Connect(function(player)
if playerCount < 1 then
game.ReplicatedStorage:WaitForChild("WillRun").Value = false
ss.inter.Disabled = true
ss.round2.Disabled = true
rsr.Intermission.Value = 10
rsr.InRound.Value = false
rsr.spawner.Value = 1
for _,v in ipairs(game.Players:GetPlayers()) do
v:LoadCharacter()
end
else
game.ReplicatedStorage.WillRun.Value = true
ss.inter.Disabled = false
ss.round2.Disabled = false
end
end)
game.Players.PlayerRemoving:Connect(function(player)
if playerCount < 1 then
game.ReplicatedStorage.WillRun.Value = false
ss.inter.Disabled = true
ss.round2.Disabled = true
rsr.Intermission.Value = 10
rsr.InRound.Value = false
rsr.spawner.Value = 1
for _,v in ipairs(game.Players:GetPlayers()) do
v:LoadCharacter()
end
else
game.ReplicatedStorage.WillRun.Value = true
ss.inter.Disabled = false
ss.round2.Disabled = false
end
end)