|
| 28 Jun 2016 04:17 PM |
This script still allows the players to be teleported to the minigame, but it does not create the time that is left:
if chosenGameClone.Name == "Lava Checkers" then spawns = chosenGameClone.CheckerSpawns:GetChildren() CheckerTime = 10 for i,v in pairs(game.Players:GetPlayers()) do name = v.Name v.Character:MoveTo(spawns[i].Position) end for i = CheckerTime, 1, -1 do timer.Value = "Time left: " .. CheckerTime end
Can anyone help me with the for loop because it is not working for me: for i = CheckerTime, 1, -1 do timer.Value = "Time left: " .. CheckerTime end
|
|
|
| Report Abuse |
|
|
6_6
|
  |
| Joined: 03 Jun 2014 |
| Total Posts: 403 |
|
|
| 28 Jun 2016 04:18 PM |
bump
#Code local Robux = 'R$44,361' |
|
|
| Report Abuse |
|
|
|
| 28 Jun 2016 04:19 PM |
Well the loop is iterating virtually instantly. I assume you want it to wait 1 second before going on:
for i = CheckerTime, 1, -1 do timer.Value = "Time left: " .. CheckerTime wait(1) end |
|
|
| Report Abuse |
|
|
AxonMega
|
  |
| Joined: 29 Aug 2014 |
| Total Posts: 2403 |
|
|
| 28 Jun 2016 04:21 PM |
| The loop you are creating is equivalent to for i = 10, 1, -1. Loops can't run from greater numbers to smaller numbers, it's the other way around. |
|
|
| Report Abuse |
|
|
|
| 28 Jun 2016 04:22 PM |
@Flux Thank you. It created a small bug, but I was able to fix it.
|
|
|
| Report Abuse |
|
|
6_6
|
  |
| Joined: 03 Jun 2014 |
| Total Posts: 403 |
|
|
| 28 Jun 2016 04:22 PM |
@Flux it works thanks
#Code local Robux = 'R$44,361' |
|
|
| Report Abuse |
|
|
|
| 28 Jun 2016 04:25 PM |
oh my god, I realized what I did wrong.
I put:
for i = CheckerTime, 1, -1 do timer.Value = "Time left: " .. CheckerTime end
Where '.. CheckerTime' should actually be '.. i' since I put 'for i'.
|
|
|
| Report Abuse |
|
|
|
| 28 Jun 2016 04:26 PM |
Axon, and yes loops can run from greater numbers to lowers. That's how you create countdowns.
|
|
|
| Report Abuse |
|
|