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: Gah, Im trying to make a sequence of parts..

Previous Thread :: Next Thread 
Infocus is not online. 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
DragonODeath is not online. DragonODeath
Joined: 02 May 2011
Total Posts: 1252
15 Sep 2013 08:34 AM
I IS NOB, SHADDAP, stahp pusting lawng screepts
Report Abuse
Infocus is not online. 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 is not online. 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
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
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 is not online. 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
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
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 is not online. 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
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
15 Sep 2013 08:55 AM
Ummwat
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
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 is not online. 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
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
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 is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
16 Sep 2013 12:11 AM
Bump
Report Abuse
Project2015 is not online. Project2015
Joined: 11 Sep 2013
Total Posts: 384
16 Sep 2013 12:33 AM
p
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
16 Sep 2013 12:33 AM
coroutines and wait(1/44)
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
16 Sep 2013 02:07 AM
sinx/x?
Report Abuse
Infocus is not online. 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
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