I have made a script to make a group of parts come towards you all at once however some of the parts move on a completely different axis and i don’t know how to fix this any help appreciated thanks.
local s = script.Parent
for _, i in pairs(s:GetDescendants()) do
if i:IsA("BasePart")then
coroutine.wrap(function()
for d = 0,10,0.01 do
i.CFrame = i.CFrame * CFrame.new(-d,0,0)
wait(0.01)
end
end)()
end
end
local s = script.Parent
for _, i in pairs(s:GetDescendants()) do
if i:IsA("BasePart")then
coroutine.wrap(function()
for d = 0,10,0.01 do
i.CFrame = i.CFrame * i.CFrame:ToObjectSpace(CFrame.new(-d,0,0))
wait(0.01)
end
end)()
end
end
although that is equivalent to the simpler
local s = script.Parent
for _, i in pairs(s:GetDescendants()) do
if i:IsA("BasePart")then
coroutine.wrap(function()
for d = 0,10,0.01 do
i.CFrame = i.CFrame + Vector3.new(-d,0,0)
wait(0.01)
end
end)()
end
end