Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is there a NumPlayers problem?

I'm confused as to why when I use Code1 and test it in a server it works, but when I use Code2 and test it with a friend it doesn't work

Code1:

while true do
	wait()
if game.Players.NumPlayers >= 1 then
	gameReady = true
	break
else
	timer.Value = "There needs to be 1 or more Player for Towergames to start."
	gameReady = false
	end
end

Code2:

while true do
	wait()
if game.Players.NumPlayers >= 2 then
	gameReady = true
	break
else
	timer.Value = "There needs to be 2 or more Players for Towergames to start."
	gameReady = false
	end
end

1 answer

Wait() Pauses a script, you know. So basically I'd do this:

while true do
	wait() until game.Players.NumPlayers > 1
	round()
	wait(1)
end

And put a function in the same script like this:

function round()
	-- PUT YOUR CODE HERE
end

2 comments

0

"ServerScriptService.GameScript:8: 'end' expected (to close 'while' at line 7) near 'until'"

0

JUST LEMME IN STUDIO AND LET ME SEE THAT SCRIPT!

This discussion is preserved as it was. New answers, comments, and votes are closed.