Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you make a character move with a rotating part?

Asked by 4 years ago
Edited 4 years ago

Hello,

Context: - I'm trying to rotate an extremely large part in my game.

Problem: - I cannot get the character to rotate with the part. At the moment, the character will fall off the part unless you move your character to stay on the part, I want the character to move with the part.

Current Script - This is the local script I am currently using to rotate the part. The part is a local part.

game:GetService("RunService").RenderStepped:Connect(function()
    clone1.CFrame = clone1.CFrame * CFrame.Angles(0, 0.005, 0)
end)

Any advice or solutions you can give me would be appreciated.

Tweakified

1 answer

Log in to vote
0
Answered by 4 years ago

Hello,

CFrame cannot do this. So I used a BodyAngularVelocity with the MaxTorque set to inf, inf, inf and the AngularVelocity set to 0, 0.2, 0 to rotate the part.

However, I ran into a problem where gravity would act on the part, pulling it down. Therefore, to solve this, I used a BodyVelocity and set MaxForce to inf, inf, inf, Power to 1250, and the Velocity to 0,0,0. This stops the part from moving.

Note: The part must not be anchored for this to work.

I made this part a local part with the below script:

local clone = game:GetService("ReplicatedStorage"):FindFirstChild("Moving1"):Clone()
clone.Parent = workspace

Hopefully this helps someone.

Tweakified

Ad

Answer this question