M = Instance.new("Message")
M.Parent = Workspace
if game.Players.Numplayers >2 then
M.Text = "Waiting For More Players"
end
end
Why Will This Not Work ?
M = Instance.new("Message")
M.Parent = Workspace
if game.Players.Numplayers >2 then
M.Text = "Waiting For More Players"
end
end
Why Will This Not Work ?
I would believe you problem is it only checks once. You could use a loop to check to see how many players there are. Also, you should have told us more information like what's going wrong? Is their no Message, etc. Also, you have an extra end
Assuming this is a regular Script, I will show you how to make this work by using a Loop so you may check over and over if their's enough players.
while true do
wait()
if game.Players.NumPlayers < 2 then
if game.Workspace:FindFirstChild("Message") then
print("Message Exist")
else
local M = Instance.new("Message", game.Workspace)
M.Text = "Waiting For More Players"
end
else
wait()
game.Workspace.Message:Destroy()
end
end
You'll notice I did a lot different then you did. I am removing the Message when their's more than 2 players, also I changed my sign to less than because I believe that's what you wanted to do. Now I made the Message inside the script so if more players leave, and there will only be 2 or 1 players left, the message will come back, but if there is more than 2, the message will come back. This is an endless loop!
This worked However It Creates Around 50 Messages!
Because it Looped.
First of all, you have too many ends
Second, line 4 is basically saying if there are more than 2 people then blah blah blah.
Change line 4 to this:
if game.Players.NumPlayers < 2 then
That is saying if NumPlayers is smaller than 2.
Please upvote and accept my answer if this helped!
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
I fixed the Message spam.