Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Change velocities of multiple objects with only one script?

Asked by 5 years ago

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
Loop through the parts inside of a model, and set their velocity User#19524 175 — 5y
0
I want the velocities change using a script, not manually cctcat70 7 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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
0
Thank you! I will try this! cctcat70 7 — 5y
Ad

Answer this question