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: Question [for i =]

Previous Thread :: Next Thread 
EliteTCer is not online. EliteTCer
Joined: 17 Dec 2008
Total Posts: 5174
08 Jun 2014 05:20 PM
When I say "for i = 0,.1,.5 do" then I state where I need the variable, it only uses it once. I am needing to use the variable 3 times.



function Open()
for i = 0,.1,.5 do
wait(.2)
Gui.Position = UDim2.new(i,0,0,0)
Gui2.Position = UDim2.new(i,0,0,0)
Gui3.Position = UDim2.new(i,0,0,0)
end
end

script.Parent.MouseButton1Up:connect(Open)
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
08 Jun 2014 05:21 PM
for i = 0, .5, .1
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
08 Jun 2014 05:22 PM
i is a variable
= is an operator
0 is the starting number
.1 is the end number
.5 is the increment.

You're asking the loop to increase from 0 to .1 by .5

0 + .5 = .5, not .1

try: i = 1,3,1
Report Abuse
EliteTCer is not online. EliteTCer
Joined: 17 Dec 2008
Total Posts: 5174
08 Jun 2014 05:23 PM
Oh woops, but still that isn't what I'm asking.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
08 Jun 2014 05:25 PM
You should be able to use the variable for all three...
Report Abuse
EliteTCer is not online. EliteTCer
Joined: 17 Dec 2008
Total Posts: 5174
08 Jun 2014 05:26 PM
It only moves the first one (Gui1)
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
08 Jun 2014 05:29 PM
try making a table of the guis, then using in pairs to process them seperately:

guis = {Gui, Gui2, Gui3}

for i = 1,3 do -- assumes increment is 1
for i,v in pairs (guis) do
v.Position = UDim2.new (i/10,0,0,0)
end
end
Report Abuse
robomax11 is not online. robomax11
Joined: 07 Jul 2011
Total Posts: 6828
08 Jun 2014 05:32 PM
coroutine.resume(coroutine.create(function()
^ is what you want. will make it happen all togther at once not one at a time.

guis = {Gui, Gui2, Gui3}

for i = 1,3 do -- assumes increment is 1
for i,v in pairs (script.Parent.GUIS:GetChildren()) do --- change this
coroutine.resume(coroutine.create(function()
v.Position = UDim2.new (i/10,0,0,0)
end
end


ˢᶦᵈᵉ ᵉᶠᶠᵉᶜᵗˢ ᵐᵃʸ ᶦᶰᶜᶫᵘᵈᵉ﹕ ᶫᵃᶜᵗᵃᵗᶦᶰᵍ, ʰᵉᵃᵈ ᵉˣᵖᶫᵒᵈᶦᶰᵍ ˢʸᶰᵈʳᵒᵐᵉ, ᵃᶰᵈ ᶫᵒˢˢ ᵒᶠ ᵍᵉᶰiᵗᵃᶫˢ
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
08 Jun 2014 05:33 PM
Right, because in pairs will do them separately.
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