so, Im trying to make a system where the player will turn based on the mouse position. That works fine, but whenever I try to walk, the directions of moving are completely messed up. Anyone know how to fix this?
I expect that the character wil move in the direction that it’s facing when I press W.
local player = game.Players.LocalPlayer local character = player.Character local mouse = player:GetMouse() local camera = workspace.CurrentCamera game:GetService("RunService").RenderStepped:Connect(function() local forwardVector = (character.HumanoidRootPart.Position - mouse.hit.Position).Unit local rightVector = forwardVector:Cross(Vector3.new(0,1,0)) local cframe = CFrame.fromMatrix(character.HumanoidRootPart.Position, -rightVector, Vector3.new(0, 1, 0)) character.HumanoidRootPart.CFrame = cframe end)