Okay, so I made this script for a minigame-game but somehow at the last line (which isn't a end line) it clones a gui only in 1 player's playergui. Here's the script.
game.Players.PlayerAdded:Connect(function(plr)
workspace:WaitForChild("PlayerCount").Value = workspace.PlayerCount.Value + 1
end)
game.Players.PlayerRemoving:Connect(function()
workspace:WaitForChild("PlayerCount").Value = workspace.PlayerCount.Value - 1
end)
workspace:WaitForChild("PlayerCount").Changed:Connect(function()
wait(1)
if workspace.PlayerCount.Value == 1 then
for i,v in pairs(game.Players:GetPlayers()) do
game.Lighting:WaitForChild("Waiting2Players"):Clone().Parent = v:WaitForChild("PlayerGui")
end
elseif workspace.PlayerCount.Value == 2 or workspace.PlayerCount.Value >= 2 then
for i,v in pairs(game.Players:GetPlayers()) do
v.PlayerGui:WaitForChild("Waiting2Players"):remove()
game.Lighting.ChoosingMinigame:Clone().Parent = v:WaitForChild("PlayerGui")
end
end
end)
It also has a player counter in it, you may have noticed. Anyone knows how to fix this?