Why does the character rotate on more than 1 axis when I only have one set?
I have a script that will make it when you press a you instantly snap to the left and when you press d you snap to the left. I have this because I am making a 2d game with sliding and I don't want the player sliding off the edge, but when I do it the character model doesn't look in the right direction and the player rotates to do a headstand. Can anyone help me?
Code:
01 | local uis = game:GetService( "UserInputService" ) |
02 | local root = game.Players.LocalPlayer.Character:WaitForChild( "HumanoidRootPart" ) |
04 | uis.InputBegan:Connect( function (input) |
05 | if input.KeyCode = = Enum.KeyCode.A then |
06 | root.Orientation = Vector 3. new(root.Orientation.x, - 90 , root.Orientation.z) |
07 | elseif input.KeyCode = = Enum.KeyCode.D then |
08 | root.Orientation = Vector 3. new(root.Orientation.x, 90 , root.Orientation.z) |
It's a local script inside of starter character scripts (I have filtering enabled off for testing)
Thanks!