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

How to check if there is more than 1 player ingame? [SOLVED]

Asked by 9 years ago

I fixed it myself. Here is the fixed script:

game.Players.PlayerAdded:connect(function(plr)
if game.Players.NumPlayers >= 2 then
    msg =Instance.new("Hint", game.Workspace)
    msg.Text = "Game Start!"
else
    msg = Instance.new("Hint", game.Workspace)
    msg.Text = "2 players needed to start."
end
end)

1 answer

Log in to vote
1
Answered by
Discern 1007 Moderation Voter
9 years ago

>= Means greater than or equal to. If the number of players is greater than or equal to one (which it is), then it will still return true. Replace 1 with 2 on line 2 and it should work.

game.Players.PlayerAdded:connect(function(plr)
if game.Players.NumPlayers >= 2 then
    msg =Instance.new("Hint", game.Workspace)
    msg.Text = "Game Start!"
else
    msg = Instance.new("Hint", game.Workspace)
    msg.Text = "2 players needed to start."
end
end)

Please accept this answer if I helped! :D

0
I fixed it before I saw your answer. But ill still give you the point because its true! TheBigCoder 25 — 9y
0
Heh, I was typing my answer as you updated your's. Sorry. Discern 1007 — 9y
Ad

Answer this question