Hey there! I’m trying to make the player snap to the rotation they are walking, but it isn’t fully working as I intended, and it will probably cause a ton of glitches in the future. The player is stuck on a 2D plain by using a BodyVelocity and removing the ability to move forward and backward.
This is what I am currently using:
uIS.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.A then -- Check if they are walking to the left
humanoidRootPart.CFrame = humanoidRootPart.CFrame*CFrame.Angles(0,math.rad(180),0) -- Rotate the player
end
if input.KeyCode == Enum.KeyCode.D then -- Check if they are walking to the right
humanoidRootPart.CFrame = humanoidRootPart.CFrame*CFrame.Angles(0,math.rad(-180),0) -- Rotate the player
end
end)
Any help is greatly appreciated!