Pls i need to help! Please how to make: How can I make a script that detects that there are 2 or more players
✓ ANSWER ACCEPTED
How can I make a script that detects that there are 2 or more players?
2 answers
✓ Accepted answer
Hello!
The NumPlayers property of Players has been deprecated and should no longer be used for new projects. http://wiki.roblox.com/index.php?title=API:Class/Players/NumPlayers&redirect=no
Instead, you should use #Players:GetPlayers()
while wait(1) do
local players = game:GetService("Players")
local numPlayers = players:GetPlayers()
if(#numPlayers>=2) then
print("we have two players, execute code here!")
end
end
Players = game:GetService("Players")
while wait() do
if Players.NumPlayers >= 2 then
-- code here
end
end
Hope this helped you.
This discussion is preserved as it was. New answers, comments, and votes are closed.
