How do you make it so the players body points in the direction of a part clicked at?

I want to make a tool that when clicking on a part it points in that parts general direction.

I want the tool to be similar to Isle’s gun system (click on an NPC or Player and it points and fires)

I don’t want to worry about the gun system yet but I am troubled on how to make the player point in the parts direction, how would I be able to do this?

I believe something like this should work?

local tool = --tool
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()

tool.Activated:Connect(function()
	local hrp = plr.Character.HumanoidRootPart
	local look = Vector3.new(mouse.Hit.p.X, hrp.CFrame.Position.Y, mouse.Hit.p.Z)
	hrp.CFrame = CFrame.new(hrp.CFrame.Position, look)
end)

Also, this will look at wherever the player clicks, not just that part since it can look very weird depending on the part. Make sure this is a local script.

I get this error,

You never defined the tool then. In this case, tool would be script.Parent

1 Like