I want to rotate the player in the direction of their camera.
Kind of like this video:
So far I found a way to do it but it’s very hacky and only works on the server. I’m trying to create my dodge system on the client to reduce the load of the server. So if anyone has a way to do it please help.
Code so far:
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hrp = char:WaitForChild("HumanoidRootPart")
local camera = game.Workspace.CurrentCamera
---The portion regarding changing the cframe will happen when you press a certain key
---As of right now it is just as it is
hrp.CFrame = CFrame.new(hrp.Position, Vector3.new(Camera.CFrame.Lookvector.X * 9999, hrp.Position.Y, Camera.CFrame.Lookvector.Z * 9999))
Get the camera’s CFrame, get the orientation with CFrame:ToOrientation(), then you should be able to get the Y rotation from it. After that, simply rotate the HumanoidRootPart as needed.