Cizox
|
  |
| Joined: 25 Dec 2009 |
| Total Posts: 42220 |
|
|
| 21 Nov 2013 06:11 PM |
messageOne = "Need at least two players to begin." messageTwo = "Enough players to begin. Loading game."
message = Instance.new("Message") message.Parent = nil
players = game.Players.NumPlayers
while true do wait() if (players <= 1) then message.Parent = game.Workspace message.Text = messageOne elseif (players > 1) then message.Parent = game.Workspace message.Text = messageTwo wait(2) message.Parent = nil end end
Tried it using Start Server and Start Player. The first message appears, but when there are more than 1 players, the message doesn't change. any help? |
|
|
| Report Abuse |
|
|
|
| 21 Nov 2013 06:14 PM |
messageOne = "Need at least two players to begin." messageTwo = "Enough players to begin. Loading game."
message = Instance.new("Message") message.Parent = nil
while true do wait() players = game.Players.NumPlayers if (players <= 1) then message.Parent = game.Workspace message.Text = messageOne elseif (players > 1) then message.Parent = game.Workspace message.Text = messageTwo wait(2) message.Parent = nil end end |
|
|
| Report Abuse |
|
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
|
| 21 Nov 2013 06:16 PM |
Because you initialize the variable players once. So, it's only storing one value.
local messageOne, messageTwo = 'Need at least two players to begin.', 'Enough players to begin. Loading game.' local message = Instance.new('Message', Workspace) -- no point in putting it in nil, if you're using a while loop it will always just parent itself to workspace
while (wait()) do local gar = players <= 1 message.Text = gar and messageOne or messageTwo message.Parent = gar and Workspace or nil end |
|
|
| Report Abuse |
|
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
|
| 21 Nov 2013 06:16 PM |
*sigh*
local messageOne, messageTwo = 'Need at least two players to begin.', 'Enough players to begin. Loading game.' local message = Instance.new('Message', Workspace) -- no point in putting it in nil, if you're using a while loop it will always just parent itself to workspace
while (wait()) do local gar = Game.Players.NumPlayers <= 1 message.Text = gar and messageOne or messageTwo message.Parent = gar and Workspace or nil end |
|
|
| Report Abuse |
|
|