|
| 19 Jun 2014 05:09 PM |
--Variables local timeAmount = 10 local player = game.Players.LocalPlayer local timer = player.PlayerGui.ToFTray.Timer.Time
--Change time for i = timeAmount, 0, -1 do timer.Text = i wait(1) end
--Go red if the time is under 6 if timer.Text <= 5 then timer.TextColor3 = Color3.new(172/255,0,0) end
I cannot compare strings (timer.Text) with numbers (5).. so how could I make this work? Thanks!
"I can't change the direction of the wind, but I can adjust my sails to always reach my destination." |
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
| |
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 19 Jun 2014 05:11 PM |
So for example
tonumber(timer.Text) |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 05:13 PM |
Thanks, but this doesnt work...
--Variables local timeAmount = 10 local player = game.Players.LocalPlayer local timer = player.PlayerGui.ToFTray.Timer.Time local timeNum = tonumber(timer.Text)
--Change time for i = timeAmount, 0, -1 do timer.Text = i wait(1) end
--Go red if the time is under 6 if timeNum <= 5 then timer.TextColor3 = Color3.new(172/255,0,0) end |
|
|
| Report Abuse |
|
|
| |
|
|
| 19 Jun 2014 05:17 PM |
timeNum doesn't change unless you tell it to. Change your loop. |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 05:17 PM |
--Variables local timeAmount = 10 local player = game.Players.LocalPlayer local timer = player.PlayerGui.ToFTray.Timer.Time
--Change time for i = timeAmount, 0, -1 do timer.Text = i wait(1) end
--Go red if the time is under 6 if tonumber(timer.Text) <= 5 then timer.TextColor3 = Color3.new(172/255,0,0) end
Doesnt work |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 05:18 PM |
| Also, that if statement wont be reached until the loop has stopped. You should put it in the loop itself and remove the timeNum variable. |
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 19 Jun 2014 05:18 PM |
Thanks, but this doesnt work...
--Variables local timeAmount = 10 local player = game.Players.LocalPlayer local timer = player.PlayerGui.ToFTray.Timer.Time
--Change time for i = timeAmount, 0, -1 do timer.Text = i wait(1) end
--Go red if the time is under 6 local timeNum = tonumber(timer.Text) if timeNum <= 5 then timer.TextColor3 = Color3.new(172/255,0,0) end
|
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 05:20 PM |
I know I probably sound stupid but
What in the loop do i change :P |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 05:20 PM |
| @smiley: You just made it run slightly slower. No need to create a local variable which you use once then abandon :P |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 05:22 PM |
Shove the if statement (with adjustments) in the loop!
local timeAmount = 10 local player = game.Players.LocalPlayer local timer = player.PlayerGui.ToFTray.Timer.Time
--Change time for i = timeAmount, 0, -1 do timer.Text = i if timeAmount <= 5 then --Your timer.TextColor3 = Color3.new(172/255,0,0) --If end --Statement wait(1) end |
|
|
| Report Abuse |
|
|
| |
|
|
| 19 Jun 2014 06:08 PM |
Sorry, brain failed.
if i <= 5 then |
|
|
| Report Abuse |
|
|
| |
|