Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Change velocities of multiple objects with only one script?

I want to make a cable car that goes up and down only on cylinders that are going only on one direction. Do I need to remake it so it can turn or is it possible to make the multiple cylinders' velocity change with only one script?

2 comments

2

Loop through the parts inside of a model, and set their velocity

0

I want the velocities change using a script, not manually

1 answer

✓ Accepted answer

You can use a generic for loop which literates or loops over a table, so you can use :GetChildren() to get the cylinders as it returns a table or a array.

local parts = workspace.cylinders:GetChildren() -- define where all the cylinders are

for _,v in pairs(parts) do
	v.Velocity = script.Parent.CFrame.LookVector * 100 --example
	print(v.Name)
end

1 comment

0

Thank you! I will try this!

This discussion is preserved as it was. New answers, comments, and votes are closed.