of     1   

BlueDanny
#141216892Wednesday, July 23, 2014 12:11 AM GMT

I'm trying to make this object bob in the air 5 blocks high then back down 5 blocks until another script interupts it.. But it's not working out very well :l It just flies straight up in the air.. Help?? Script:: Part = game.Workspace.Atom repeat local i = 5, -5, 0.1 Part.CFrame = Part.CFrame + Vector3.new(0,i,0) wait() until Part.CFrame.Y <= 18.5
BlueDanny
#141216987Wednesday, July 23, 2014 12:12 AM GMT

I meant for the last line to be: until Part.CFrame.Y <= 18.5
blockoo
#141217099Wednesday, July 23, 2014 12:13 AM GMT

I think what you want is a "for" loop: Part = game.Workspace.Atom for i = -5, 5, 0.1 do Part.CFrame = Part.CFrame + Vector3.new(0, i, 0) wait() end That will only make it go up though, and not down.
BlueDanny
#141217891Wednesday, July 23, 2014 12:22 AM GMT

Well, perhaps I did this : Part = game.Workspace.Atom for i = 0.1, 100 do i = 0.1 Part.CFrame = Part.CFrame + Vector3.new(0, i, 0) wait() end Which makes it rise 0.1 of a brick 100 times, Well, how could I have the this: Part = game.Workspace.Atom for i = -0.1, 100 do i = -0.1 Part.CFrame = Part.CFrame + Vector3.new(0, i, 0) wait() end Lower it to it's original position HOW CAN I MIX THEM TOGETHER TO DO IT FOREVER?
blockoo
#141218369Wednesday, July 23, 2014 12:27 AM GMT

Your loops and variables are kind of iffy. Use this: function float() for i = 1, 100 do Part.CFrame = Part.CFrame + Vector3.new(0, 0.1, 0) wait() end for i = 1, 100 do Part.CFrame = Part.CFrame - Vector3.new(0, 0.1, 0) wait() end float() end float()
doneyes
#141218435Wednesday, July 23, 2014 12:28 AM GMT

loop
BlueDanny
#141218444Wednesday, July 23, 2014 12:28 AM GMT

This works as well.. Part = game.Workspace.Atom while true do for i = 0.1, 100 do i = 0.1 Part.CFrame = Part.CFrame + Vector3.new(0, i, 0) wait() end for i = -0.1, 100 do i = -0.1 Part.CFrame = Part.CFrame + Vector3.new(0, i, 0) wait() end end
blockoo
#141218880Wednesday, July 23, 2014 12:33 AM GMT

@BlueDanny It may work, but you can clean it up quite a bit. You don't need the "i = 0.1" and "i = -0.1" lines. Also, your for loops are only counting in increments of 1, so stating on 0.1 isn't really necessary. "for i = 1, 100 do" looks better and works the same.
zub74
#141219644Wednesday, July 23, 2014 12:41 AM GMT

As for your until another script interrupts it part, just put something like this right after the beginning of your loop: if Workspace.Interrupter.Value=false then and after the rest of your script: else script.Parent:Destroy() end Just make a bool value named Interrupter in workspace or wherever.
zub74
#141219724Wednesday, July 23, 2014 12:42 AM GMT

Sorry, don't know why I threw in .Parent... Just script:Destroy()

    of     1