So I have been making a script where a gui hides until main menu is over and the player enters intermission for a round based system game (The GUI will also hide when the round starts). Well, once someone wins the game and returns to intermission, the remote events I put in the code won’t run again for some reason. It only works when the player first enters intermission after main menu is over and I do not know why this is happening, can someone please help me? It will be great if you are willingly to stop by to help me.
Try removing that if statement where it checks the team, I think its useless because you’re literally assigning the team the line before and maybe something from the ES and SS remotes could be causing the problem (i got this on the top of my i doubt what i said works)
game.ReplicatedStorage.ChangeTeam.OnServerEvent:Connect(function()
for i, v in pairs(Players:GetChildren()) do
if v:IsA("Player") then
v.Team = game.Teams["Not Playing"]
ES:FireAllClients()
SS:FireAllClients()
end
end
end)
The thing I was trying to do didnt work so I just removed the condition and changed the Children to Players so it doesnt get any other object other than a player
game.ReplicatedStorage.ChangeTeam.OnServerEvent:Connect(function()
for i, player in pairs(game:GetService("Players"):GetPlayers()) do
player.Team = game.Teams["Not Playing"]
ES:FireAllClients()
SS:FireAllClients()
end
end)