Hi,
I would like the parts to move up & down and they should follow each other. so like a sine curve. but each neighboring part should move a little delayed.
But i only get all parts move
Could someone help me?
my script:
local Folder = script.Parent
local Inside = Folder:GetChildren() β Assigning a local variable is faster.
for _, Search in ipairs(Inside) do
if Search:IsA(βPartβ) then
local amplitude = 3 β offset on both sides
local magnitude = 2.5 β time it takes to move from the bottom β top, and top β bottom
local part = Search
local defaultCFrame = part.CFrame
game:GetService(βRunServiceβ).Stepped:Connect(function()
part.CFrame = defaultCFrame + Vector3.new(0, amplitude*math.sin(tick()*math.pi/magnitude), 0)
end)
end
end