Character facing mouse not working

In my game the camera faces down on the player and faces the mouse with this code:

Local rootpart = player.Character:WaitForChild(“HumanoidRootPart”)
Local mousepos = mouse.hit.p
Local lookvector = Vector3.new(mousepos.X, rootpart.CFrame.Y, mousepos.Z)
rootpart.CFrame = CFrame.new(rootpart.CFrame.p, lookvector)

No errors show up but when I run it, the character faces ~90° to the right of where the mouse is. The camera faces down by setting the cameras CFrame to a block that hovers above and follows the character. When I don’t set the camera CFrame it works fine. I don’t know what the issue is.

1 Like

I fixed it by setting the camera type to scriptable.

1 Like

Goodjob you solved it yourself lol.

1 Like