When I try moving multiple parts but with the same distance and speed it breaks. When I add or remove parts the distance and speed also change. Even when it’s only moving one part, it still behaves wrong.
local distance = 5
local speed = 2
for _,v in pairs(workspace.Folder:GetChildren()) do
spawn(function()
local startPosition = v.Position
while true do
local newPosition = startPosition + Vector3.new(0,math.sin(tick() * speed) * distance, 0)
v.Position = newPosition
wait(0.01)
end
end)
end
also they were going higher because you were setting the startpos every time they moved which made it go to the same position it was at + the movement
It’s because on every object iteration, it yields making the last part to get moved not in sync. You need to create a thread for every part, just like what @silas_4008 provided