Chair not rotating as expected

Hello there, Developers!
I am having a bit of trouble with CFrames. I have likely forgotten something basic about rotation, but I would like your help to figure it out. Any help is appreciated!

What is my problem?
Currently, I am attempting to make a chair spin with the keys A & D, but it is not moving as expected.

Video: Gyazo

Local script:

local event = nil
local RS = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local centre = game.Workspace.Throne.PrimaryPart
local aDown = false
local dDown = false
UIS.InputBegan:Connect(function(input, processed)
	if processed then return end
	if input.KeyCode == Enum.KeyCode.A then
		aDown = true
	if input.KeyCode == Enum.KeyCode.D then
		dDown = true
UIS.InputEnded:Connect(function(input, processed)
	if processed then return end
	if input.KeyCode == Enum.KeyCode.A then
		aDown = false
	if input.KeyCode == Enum.KeyCode.D then
		dDown = false

	if game.Workspace.Throne.Seat.Occupant == nil then
		if event ~= nil then
			event = nil
	local occupant = game.Workspace.Throne.Seat.Occupant
	local player = game.Players:GetPlayerFromCharacter(occupant.Parent)
	if player == nil then return end
	if whitelist[player.UserId] == nil then return end
		if aDown then
			centre.CFrame = * CFrame.Angles(centre.Orientation.X, centre.Orientation.Y - (35 *delta), centre.Orientation.Z)
		elseif dDown then
			centre.CFrame = * CFrame.Angles(centre.Orientation.X, centre.Orientation.Y + (35 *delta), centre.Orientation.Z)
			print(" D DOWN")

Don’t mind the mess. I know there are incomplete parts, but at the moment I am just working on the rotation and will fix those later.

For context; the player is given network ownership of the chair parts that are connected with a WeldConstraint to the main part which is being moved.

Thanks for your help!

If 1 person sits in a chair, wouldn’t the last section of code be running for all players?

CFrame.Angles(x,y,z) uses radians not degrees so you have to convert them by using math.rad(deg)

Edit : If you want to do it on the server, you should use a VechicleSeat because it has a property called Steer and SteerFloat. I got that from here.

1 Like

I will look into that, but for now, you have solved my problem.
I knew it would be something as simple as that but just could not think of what. Thanks for the help!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.