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

How to create a instance of message if there are less then 2 players in a server?

I want to make to make a script which Creates a Message if there are less then 2 players, But I don't know how. also if you're using any loops such as: for i,_v in pairs or any loops similer, can you explain to me why your using them and how they work, thanks

1 answer

Explanation:

This does require one loop, that is while true do. I will now explain it

While true do is a loop which does some code while the middle word is active. Since it is true, the loop goes on until the game is false, which is when the server ends.

I hope that helped you, here is the answer

My Answer:

Here is the way I would do it

Script:

local debounce = false
while true do
	if game.Players.NumPlayers <= 2 then
		if debounce == false then
			debounce = true
			local m = Instance.new("Message", game.Workspace)
			m.Text = "Whatever you like"
		end
	end
	if game.Players.NumPlayers >= 3 then
		if debounce == true then
			debounce = false
			if game.Workspace:FindFirstChild("Message") then
				game.Workspace.Message:Destroy()
			end
		end
	end
end

I hope this answer helped you

1 comment

0

Thanks, Also what does Debounce do, It always confuses the fk outta me and Wiki is no help at all.

This discussion is preserved as it was. New answers, comments, and votes are closed.