How do I fix this movement script?

So I am making a moving part where it goes from a part to b part and I found a good model that helped with it a lot. How do I make this only rotate when I reach the part and slow down the movement speed. At the moment it goes really fast and rotates the whole time.

local Movement = Instance.new("BodyPosition")
Movement.Parent = script.Parent

local No_rotation = Instance.new("BodyAngularVelocity")
No_rotation.Parent = script.Parent

local P1 = script.Parent.Parent.P1
local P2 = script.Parent.Parent.P2
script.Parent.Parent.P1.Transparency = 1
script.Parent.Parent.P2.Transparency = 1

while true do
	Movement.Position = P1.Position
	wait(script.Parent.Wait_val.Value)
	Movement.Position = P2.Position
	wait(script.Parent.Wait_val.Value)
end

Lower the speed by doing

Movement.P = script.Parent:GetMass() * time

Then set No_rotations parent after Movement.Position is equal to P2

2 Likes

so

local Movement = Instance.new("BodyPosition")
Movement.Parent = script.Parent
Movement.P = script.Parent:GetMass() * time

?

1 Like