When there is 1 player the message pops up but when the other player comes it doesn't go away
if game.Players.NumPlayers <= 1 then Instance.new("Message", Workspace) wait(0.1) game.Workspace.Message.Text = "This game needs at least 2 players to start!" game.Workspace.Mainscript.Disabled = true else game.Workspace.Message.Text = "Game starting!" wait(5) game.Workspace.Message.Text = "" wait(1) game.Worksapce.Mainscript.Disabled = false end
You need to keep looping the script so that it updates the amount of players that are in the game.
local message = --Save this variable for later. while wait() do if game.Workspace:FindFirstChild("Message") == nil then --If the message is not in Workspace, create it. message = Instance.new("Message", game.Workspace) end if game.Players.NumPlayers <= 1 then game.Workspace.Message.Text = "This game needs atleast 2 players to start!" game.Workspace.Mainscript.Disabled = true repeat wait() until game.Players.NumPlayers >= 2 --Wait until there are 2 or more players in game. else game.Workspace.Message.Text = "Game starting!" wait(5) game.Workspace.Message.Text = "" wait(1) game.Worksapce.Mainscript.Disabled = false repeat wait() until game.Worksapce.Mainscript.Disabled == true --Waits until the game is over. (Assuming the game ends when the Mainscript is disabled.) end end