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:
local uis = game:GetService("UserInputService") local root = game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart") uis.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.A then root.Orientation = Vector3.new(root.Orientation.x, -90, root.Orientation.z) elseif input.KeyCode == Enum.KeyCode.D then root.Orientation = Vector3.new(root.Orientation.x, 90, root.Orientation.z) end end)
It's a local script inside of starter character scripts (I have filtering enabled off for testing) Thanks!