Moving platform teleporting over my head when i stand on it

Hey folks, So i’m pretty new to scripting and know basically nothing, And i wanted a script for something i’m making that moves a platform just up and down, It works fine unless you step on it which you need to do to, If you step on it the platform suddenly gets teleported over your head, I’ve tried everything i could think of but couldn’t fix this issue, Here’s my code

script.Parent.PrimaryPart = script.Parent.mobywood

function move(x,y,z)
for i=1,20 do
script.Parent:MoveTo(script.Parent.mobywood.Position + Vector3.new(x,y,z))
       wait(0.01)
end
end

while true do

move(0.01,0.01,0)
move(0.02,0.02,0)
move(0.03,0.03,0)
move(0.02,0.02,0)
move(0.01,0.02,0)
wait(0.2)
move(-0.01,-0.01,0)
move(-0.02,-0.02,0)
move(-0.03,-0.03,0)
move(-0.02,-0.02,0)
move(-0.01,-0.01,0)


end


Appreciate the help, Thanks.

I think the problem is in :MoveTo Use This :SetPrimaryPartCFrame()

It didn’t work, All it did was stop the platform from moving

script.Parent:SetPrimaryPartCFrame(script.Parent.mobywood.CFrame + Vector3.new(x,y,z))

I have nothing more to offer

1 Like