I have pasted part of my script below. The script is supposed to check if there are two people in the game, and if so then delete a GUI, but if not then it should just keep waiting. HOWEVER, when I play online to test it out, I am the only person in the game but the script will start running as if there were 2 people.
while true do
if game.Players.NumPlayers >=2 then --Check if more than or equal to 2 players
for i, v in pairs(game.Players:GetChildren()) do
local playergui = v:FindFirstChild("PlayerGui")
if playergui then
local somegui = playergui:FindFirstChild("playercheckgui")
if somegui then
somegui:Destroy()
print("Destroyed first GUI in PlayerGui")
else
print("Wait")
end
end
end
end
------
end --(this end is for the while true do where there is more stuff inbetween here)

1 comment
You forgot to account for when players leave the server. :P