The whole code works perfect but I just added in "while game.Players.NumPlayers > 2 do" instead of "while wait() do" and what I want is to make a message with "Message1("Needing 2+ players to start")" if there are less than 2 players in the game.
--I have more code up here but not gonna paste because long code. while game.Players.NumPlayers > 2 do Horn:Play() GetIntermission() Message1("Setting up game...") Horn:Stop() Announcment:Play() wait(2) Message2(" ") GetMap() wait(1) GetPlayers() GetGametime() Message1("Game ending...") wait(2) ReturnPlayers() RemoveMap() end
You was making it ask if their was more players then 2 online if so then it would return true but you want it to return true if their is less then 2 players online so 1 > 2 = false but 1 < 2 = true
1 < 2 = if 1 is less then 2 other words if 1 is less then 2 then return true if not then false
1 > 2 = if 1 is greater then 2 other words if 1 is higher then 2 then return true if not then false
while game.Players.NumPlayers < 2 do Horn:Play() GetIntermission() Message1("Setting up game...") Horn:Stop() Announcment:Play() wait(2) Message2(" ") GetMap() wait(1) GetPlayers() GetGametime() Message1("Game ending...") wait(2) ReturnPlayers() RemoveMap() end
I suggest you split the condition from the while loop using the if statement, using else to display the message
--I have more code up here but not gonna paste because long code. while true do if game.Players.NumPlayers < 2 then Horn:Play() GetIntermission() Message1("Setting up game...") Horn:Stop() Announcment:Play() wait(2) Message2(" ") GetMap() wait(1) GetPlayers() GetGametime() Message1("Game ending...") wait(2) ReturnPlayers() RemoveMap() else wait(.1) Message1("Needing 2+ players to start") end end
Basically what you said is that you need 2 more or greater than 2 players to play. but when you use >= 2 it means there must be at least 2 players or more!
while game.Players.NumPlayers >= 2 do Horn:Play() GetIntermission() Message1("Setting up game...") Horn:Stop() Announcment:Play() wait(2) Message2(" ") GetMap() wait(1) GetPlayers() GetGametime() Message1("Game ending...") wait(2) ReturnPlayers() RemoveMap() else Message1('There must be at least 2 players to start!') end