Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

If there were more than two players would this script run?

Asked by 9 years ago

I was wondering if this would run the script if there is more than two players in the game

if game.Players.NumPlayers == 2 then

----rest of script
end

if it does not run if there are more than two players, Is there a way to make it to where it's like Two or More?

3 answers

Log in to vote
4
Answered by 9 years ago
if game.Players.NumPlayers >= 2 then --if there are at least two players (two or more) do this
    --code
end

You can use ==, >= <=, >, <, and ~=. They compare "are equal to", "greater then or equal to", "less than or equal to", "greater than", "less than", and "are not equal to", respectively.

Ad
Log in to vote
0
Answered by 9 years ago

pretty sure it wouldn't work with more than two. I think to make it work with more than two it would be ~~~~~~~~~~~~~~~~~ if game.Players.NumPlayers >= 2 then -- rest of script end ~~~~~~~~~~~~~~~~~ if not then try switching >= to =<. If that doesn't work then Idk what to do

Log in to vote
0
Answered by 9 years ago

Do

if game.Players.NumPlayers >= 2 then
---- rest of script
end

Answer this question