Hello, I’m attempting to make a script that finds all models in a folder, and rotates them all simultaneously.
While this script does successfully rotate the parts, it does so one at a time.
How would I go about making the code rotate all the models at once?
I currently have the below code in a disabled script and call it when the models need to be rotated.
Again this works fine, but only moves the models one at a time.
Current code below.
-- Table Vars
Table = workspace.TowerSystems.LaunchTable
Water = workspace.TowerSystems.WaterSystem
Arms = Table.Arms
local clamps = {}
local function FindClamps(obj)
for _, child in pairs(obj:GetChildren()) do
if child:IsA("Model") then
table.insert(clamps, child)
end
FindClamps(child)
end
end
FindClamps(Arms)
local function OpenClamps()
for _, clamp in pairs(clamps) do
for i = 1, 25 do
wait(0.005)
clamp:SetPrimaryPartCFrame(clamp.PrimaryPart.CFrame * CFrame.Angles(math.rad(-2.2),0,0))
end
end
end
OpenClamps()