How to auto rotate my floating speeder?

I want to push the speeder sideways then it will rock back and forth until stopping straight up again.

I tried having an angular velocity, then having an x and z variable that changes how far it will rotate, then if the speeder is rotated one way, then I would add x by 0.5, and in the other direction, I would add -0.5.

This way it wouldn’t stop as soon as it reaches the upright position, it would go a little beyond that, created the realistic rocking movement.

The problem is, if I push it, it would rock back, then instead of having less rotate, it would end up having more, making it flip 360 degrees.

local speeder = script.Parent.Parent
local x = 0
local z = 0
while true do
if speeder.Parts.Mass.Orientation.Z < -0.05 then
z += 1
elseif speeder.Parts.Mass.Orientation.Z > 0.05 then
z -= 1
end
if speeder.Parts.Mass.Orientation.X < -0.05 then
x += 1
elseif speeder.Parts.Mass.Orientation.X > 0.05 then
x -= 1
end
speeder.Parts.Mass.AngularVelocity.AngularVelocity = Vector3.new(x,0,z)
wait(0.1)
end

1 Like