How can I stop a moving part from rotating?

Hey there! So I’ve been trying to make a moving part which players can jump on and move through it, for a obby of mine. I’ve made it with BodyPosition and added BodyGyro to stop it from constantly rotating on it’s sides while moving, I tried to increasing the BodyGyro’s BodyTorque to 40000,40000,40000 but it still does not work.

Here is my script which I’m using to move the part:

local MovingPlatform = script.Parent.Parent.MovingPlatform
local MovingP = MovingPlatform.MovingP
local Start = MovingPlatform.Start
local Finish = MovingPlatform.Finish
local bodyposition = MovingP.BodyPosition

Time = 3

while true do
	bodyposition.Position = Start.Position
	wait(Time)
	bodyposition.Position = Finish.Position
	wait(Time)
end

BodyGyro:
image

BodyPosition:

I actually have 2 moving parts for this, the first one seems to be working while the second one keeps on rotating.

Video:
https://gyazo.com/747037480dc7411914c04d7015d7e2d7

1 Like

Try

local MovingPlatform = script.Parent.Parent.MovingPlatform
local MovingP = MovingPlatform.MovingP
local Start = MovingPlatform.Start
local Finish = MovingPlatform.Finish
local bodyposition = MovingP.BodyPosition
local OrigOrientation = MovingPlatform.Orientation

Time = 3

MovingPlatform:GetPropertyChangedSignal("Orientation"):Connect(function()
    MovingPlatform.Orientation = OrigOrientation
end)

while task.wait(Time) do
	bodyposition.Position = Start.Position
	task.wait(Time)
	bodyposition.Position = Finish.Position
end

This happens lol:
https://gyazo.com/f11d575f07744105e1aad9d9957a7564

Ah, Roblox physics. How about adding a bodygyro then?

local MovingPlatform = script.Parent.Parent.MovingPlatform
local MovingP = MovingPlatform.MovingP
local Start = MovingPlatform.Start
local Finish = MovingPlatform.Finish
local bodyposition = MovingP.BodyPosition
Time = 3

local BodyGyro = Instance.new("BodyGyro")
BodyGyro.P = 9999999999999999999999999
BodyGyro.D = 0
BodyGyro.MaxTorque = Vector3.new(99999999999,99999999999999,9999999999999)
BodyGyro.CFrame = MovingPlatform.CFrame
BodyGyro.Parent = MovingPlatform

while task.wait(Time) do
	bodyposition.Position = Start.Position
	task.wait(Time)
	bodyposition.Position = Finish.Position
end

Before moving the object you have to set BodyGyro.CFrame to the current rotation.

1 Like