Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

make player move along cframe rotation?

wheel.ClickDetector.MouseClick:connect(function()
	clicked = clicked + 1
	wheel.CFrame = wheel.CFrame * CFrame.Angles(1.1,0,0)
	turntable:WaitForChild("stand").CFrame = turntable:WaitForChild("stand").CFrame * CFrame.Angles(1.1,0,0)
end)

Okay, so there is a spinning cylinder that the player is standing on ( turntable:WaitForChild("stand").CFrame). How would I make it so that people standing on it also move with the rotation, instead of just floating ontop of the cylinder while its spinning?

1 comment

0

CFrame.Angles needs radians, unless those numbers u put are already radians. To convert to radians, use math.rad

1 answer

ok, what you are doing is that you change the Cframe.Angle instantaneously. If you have it smoothly spin, then the friction will kick in and make the character move along.

2 ways to fix this

  1. put a seat on the cylinder and have the player stand on it

  2. as i said, have it smoothly turn

2.a to make its smoothly turn, you can use a hinge contraint

2.b you can slowly turn the cframe.angle (i'm not sure if this will work)

Here is the code for method 2b

wheel.ClickDetector.MouseClick:connect(function()
    clicked = clicked + 1
    smoothness = 0.1 --smaller the smoother
    for i = smoothness, 1.1 do
    wheel.CFrame = wheel.CFrame * CFrame.Angles(smoothness,0,0)
    turntable:WaitForChild("stand").CFrame = turntable:WaitForChild("stand").CFrame * CFrame.Angles(smoothness,0,0)
wait(smoothness)
end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.