Can't figure out why this CFrame code won't work

Hello, I’m having this issue with making a flashlight point to a players mouse position. I’ve attached a video on the behaviour that happens.

For some reason the flashlight rotates on one axes but also seems to rotate on another, and I’ve noticed that the direction it’s pointing in is offset by 90 degrees, which I’m also not sure how to fix.

What I really want for it to do is to rotate on all axes towards the mouse. This is the relevant code I’m using to update the CFrame:

RunService.Heartbeat:Connect(function()
	if equipped and hand then
		script.Parent.CFrame = CFrame.lookAt(hand.Position, mouse.Hit.p, Vector3.new(0, 1, 0))
	end
end)

You could try

CFrame.lookAt(hand.Position, mouse.Hit.p, Vector3.new(0, 1, 0)) * CFrame.Angles(0, math.rad(90),  0)
1 Like

Thank you so much! This works perfectly!

Never mind, I though lookAt used 2 parameters only

Oh sorry I was looking at it wrong, there was a lookAt method and then it was multiplied by an CFrame