Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

{Simple Script} Need Help?

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 ?

1 comment

0

I fixed the Message spam.

2 answers

✓ Accepted answer

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!

2 comments

0

This worked However It Creates Around 50 Messages!

1

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.