If I would my cursor to click on lets say another player head how do I find the exact body part instead of accessories getting in the way.
I would use Mouse.Target to find if they are actually clicking on the character first of all (mouse.Target.Parent == character). If the target is in fact a character limb, then you’re good to go. However, if it’s an accessory you could you get the magnitude from either the accessory position or mouse.Hit and see which limb is closest to that position.
Also, mouse.Target probably won’t pick up Accessories since they have small handles, but if it’s a mesh part (hair for ex.), then it would.
Can you give me an example code of how to detect which body part it is
Well you can try turning of the CanQuery of the Accessory Handles, this better be in the ServerScriptService. But I do not know, if it completely works!
game.Players.PlayerAdded:Connect(function(p)
p.CharacterAdded:Connect(function(c)
for _,v in pairs(c:GetChildren()) do
if v:IsA("Accessory") then
v.Handle.CanQuery = false
end
end
end)
end)