Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 15 Sep 2013 08:32 AM |
With a for loop.
Im basically trying to make it rise up then back down, then the following part moves forward then it goes up then down again.
Heres a theory:
for i = 1, 10 do
ray = Instance.new("Part", workspace) ray.Anchored = true ray.Size = Vector3.new(1, 1, 1) ray.CFrame = CFrame.new(0, -10, -i*2) -- Spawn from below; and goes forward each sequence. for x = 1, 10 do ray.CFrame = ray.CFrame * CFrame.new(0, 1, 0) wait() end for x = 1, 10 do ray.CFrame = ray.CFrame * CFrame.new(0, -1, 0) wait() end
game.Debris:AddItem(ray, 4) end
This works, but Im trying to make it faster and much more efficient.
What it does right now is raise a part up, then back down. Then the loop goes on with another part that raises back up then down..etc.
What I want it to do is follow simultaneously.
Sort of like this:
________________________________ --Base [][][][][][][][][][][][] -- Parts
Now heres what It does now: Goes up
[]______________________________ --Base ...[][][][][][][][][][][] -- Parts then it goes down, then the next part goes up.
_[]______________________________ --Base []..[][][][][][][][][][] -- Parts
HERES WHAT I WANT IT TO DO: WHEN THE FIRST PART IS ABOUT TO GO DOWN, THE SECOND PART HAS ALREADY BEGUN TO GO UP. I hope it makes sense qq
[] []___________________________ --Base ...[][][][][][][][][][] -- Parts
|
|
|
| Report Abuse |
|
|
|
| 15 Sep 2013 08:34 AM |
| I IS NOB, SHADDAP, stahp pusting lawng screepts |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 15 Sep 2013 08:40 AM |
Wha- wha- what did she say Mmmm whatcha say, Mmm that you only meant well? Well of course you did Mmmm whatcha say, Jason Derulo Mmmm that it's all for the best? Of course it is
Its not long, the explanation is though |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 15 Sep 2013 08:42 AM |
Made a mistake on the last part of the 'diagram'
Suposed to look like this
[] -- FIrst part _[]________________________ --Base ....[][][][][][][][][][] -- Parts
When the first part is about to go down, the second part raises
|
|
|
| Report Abuse |
|
|
|
| 15 Sep 2013 08:49 AM |
So liek
for i = 1, 10 do
ray = Instance.new("Part", workspace) ray.Anchored = true ray.Size = Vector3.new(1, 1, 1) ray.CFrame = CFrame.new(0, -10, -i*2) -- Spawn from below; and goes forward each sequence.
for i = 1, 10 do ray.CFrame = ray.CFrame + Vector3.new(0,1,0) wait() if Prevray then Prevray.CFrame = Prevray.CFrame + Vector3.new(0,-1,0) end end Prevray = ray end |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 15 Sep 2013 08:51 AM |
So you checked if the previous ray isnt nil, if it wasnt, you bring it down a stud?
Seems legit qq |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2013 08:52 AM |
Is not rite? `Course if it is you will have to add another loop to fix the last part. |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 15 Sep 2013 08:54 AM |
Hrm..
I have a feeling that if I check the loop on a #
if i == 9 then --nother loop end
but idk |
|
|
| Report Abuse |
|
|
| |
|
|
| 15 Sep 2013 08:58 AM |
This is a fix for dat last part: for i = 1, 10 do
ray = Instance.new("Part", workspace) ray.Anchored = true ray.Size = Vector3.new(1, 1, 1) ray.CFrame = CFrame.new(0, -10, -i*2) -- Spawn from below; and goes forward each sequence.
for i = 1, 10 do ray.CFrame = ray.CFrame + Vector3.new(0,1,0) wait() if Prevray then Prevray.CFrame = Prevray.CFrame + Vector3.new(0,-1,0) end end Prevray = ray end
for i = 1, 10 do ray.CFrame = ray.CFrame + Vector3.new(0,-1,0) wait() end
|
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 15 Sep 2013 09:05 AM |
Ill test that tomorrow, but wht I meant was.
for I = 1, 10 do --blah if i == 10 then --for loop end end
Idk |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2013 09:07 AM |
| Err Or you could just end the first for loop and put it afterwards so it executes after all that is done with. |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
| |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
| |
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 16 Sep 2013 02:12 AM |
| I wouldn't attempt trig functions because I would be scripting blindly. |
|
|
| Report Abuse |
|
|