I have made this:
if game.Players.NumPlayers >= 4 then
end
I have made this:
if game.Players.NumPlayers >= 4 then
end
if game.Players.NumPlayers >= 4 then -- Check for 4 or more players
print("There is four or more players in the game") -- Print in output
-- Extra Code
end
This should work, you never had it to check. You should also add a while true do loop to constantly check if there is 4 players..
while wait() do -- Loop through to constantly do what is inside code
if game.Players.NumPlayers >= 4 then -- Check for 4 or more players
print("There is four or more players in the game") -- Print in output
-- Extra Code
end
end
If this helped then remember to rate up and accept answer for others.
Okay :D I will try it and I will rate you up :D
Wait it says: 12:04:40.422 - Player is not a valid member of DataModel 12:04:40.422 - Script 'Workspace.Script', Line 2 12:04:40.423 - Stack End
On line 2, he put "game.Player" which is wrong, it suppose to be "game.Players"
Mine should work now
Your error is that the script is running before there are 4 players in the game, and the script just stops there. You need the script to run over and over to continually check if there are 4 players.
I prefer not to use while loops. I think repeat loops would be better for this. Repeat loops run until the statement after "Until" is true. Then the code continues once the conditional statement is met.
repeat wait() until game.Players.NumPlayers >= 4
print("There is four or more players in the game!")
That doesn't seem to print it.
I just tested it, and it printed just fine for me when I inserted 4 players into a game.
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
No errors or anything in output...
and... your point.... it works, it's cause you need it to DO something inside the if statement