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

make player move along cframe rotation?

Asked by 6 years ago
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?

0
CFrame.Angles needs radians, unless those numbers u put are already radians. To convert to radians, use math.rad hiimgoodpack 2009 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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)

Ad

Answer this question