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 » Scripting Helpers
Home Search
 

Re: for loops

Previous Thread :: Next Thread 
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
13 Jul 2011 09:38 AM
would this work?

h = Instance.new("Hint")
h.Parent = Workspace
for i = 60,0,-1 do
h.Text = i
wait(1)
end
h:Remove()
while true do
wait(20)
h.Text = i
end

I'm trying to make sure that after the 60 seconds 20 seconds later the hint will go back to 60
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
13 Jul 2011 11:21 AM
no, because 'i' would be considered nil, or if I'm wrong it will constantly be 0. You also have removed the hint.


while true do
h = Instance,new("Hint",workspace)
for i=60,0,-1 do
h.Text = i
wait(1)
end
wait(20)
h:remove()
end
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
13 Jul 2011 11:47 AM
@bunnyboy
the script worked(mine) but it only did it once.
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
13 Jul 2011 11:51 AM
Also, that didnt work.
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
13 Jul 2011 11:52 AM
Becuase I had a typo

while true do
h = Instance.new("Hint",workspace)
for i=60,0,-1 do
h.Text = i
wait(1)
end
wait(20)
h:remove()
end
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
13 Jul 2011 12:16 PM
didnt work :O I think it needs a string.
Report Abuse
DingDong272 is not online. DingDong272
Top 100 Poster
Joined: 08 Dec 2007
Total Posts: 9860
13 Jul 2011 12:24 PM
h = Instance.new("Hint")
h.Parent = Workspace
for i = 60,0,-1 do
h.Text = i
wait(1)
end
h:Remove()
while true do
wait(20)
h.Text = i
end

After your wait you try to index 'h' again, which doesn't exist because you ended the for loop. Instead, try this:

h = Instance.new("Hint")
function theHint()
h.Parent = workspace
for i = 60, 0, -1 do
h.Text = i
wait(1)
end
h.Parent = nil
wait(20)
theHint()
end

That should work.
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
13 Jul 2011 09:21 PM
Nevermind, I found how to do it by myself.I don't nee dyour help anymore but thanks
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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