generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Time.

Previous Thread :: Next Thread 
Apeshifter is not online. Apeshifter
Joined: 20 Feb 2012
Total Posts: 26
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 is not online. 6_6
Joined: 03 Jun 2014
Total Posts: 403
28 Jun 2016 04:18 PM
bump


#Code local Robux = 'R$44,361'
Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
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 is not online. 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
Apeshifter is not online. Apeshifter
Joined: 20 Feb 2012
Total Posts: 26
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 is not online. 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
Apeshifter is not online. Apeshifter
Joined: 20 Feb 2012
Total Posts: 26
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
Apeshifter is not online. Apeshifter
Joined: 20 Feb 2012
Total Posts: 26
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image