Mouse.Target (How do I detect HumanoidRootPart if the mouse.target is a acessory)

How can I only detect body parts of a user with mouse.target without their acessories?
For example, when I aim at a acessory, it will go through it and directly detect the HumanoidRootPart

LocalScript inside tool:

local tool = script.Parent
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()


while wait() do
	local target = mouse.Target
	
	if target then print(mouse.Target.Parent) end -- I only want to get body part that is detected, not aceossries.
	-- But if aceessory is detected, i need it to print the "HumanoidRootPart"

end

Since mouse.Target detects the Handle in the Accessory, maybe try using mouse.Target:FindFirstAncestorOfClass(className). That should find the character model.

After that, it’s as simple as doing a FindFirstChild() of WaitForChild() for the HumanoidRootPart.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.