Make gun Point Towards Player's Mouse

I am trying to make a gun point towards the player’s mouse but I can’t find out how to. I have already tried searching other topics but none of them worked.

This is what currently happens: https://gyazo.com/014282bc4123391de127d3747297fb83

Here is the code:

local Character = Player.Character
local ToolHandle = Tool:WaitForChild("Handle")
local MouseLookVector = Mouse.Hit.LookVector
ToolHandle.CFrame = CFrame.new(ToolHandle.CFrame.Position, MouseLookVector)
2 Likes

why do u use lookvector? just use mouse.hit.p if u are using vector3 but if u are using cframe use mouse.hit

2 Likes

Have you tried doing something that was along the lines of this?

It would need tweaked obviously for the ToolHandle, but other than that this will stop your brain hurting from inverse kinematics.

1 Like

For some reason I am getting this error and I can’t fix it.
Capture

Here’s is the code:

local ToolHandle = Tool:WaitForChild("Handle")
local HandleOrigin = ToolHandle.C0

It’s either looking for Motor6D or WeldConstraint