Im trying to see if a users mouse is on a user problem is I don't know how to know if the part the mouse is on is part of the user here is what I am trying
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
function find_parent(item)
for _,v in pairs(game.Players:GetChildren()) do
local success, response = pcall(function()
local catch = item
while true do
if catch.Parent.Name == v.Name then
return true
end
catch = catch.Parent
wait()
end
end)
if success then
return response
else
return false
end
end
end
mouse.Move:connect(function()
local target = workspace:FindPartOnRay(
Ray.new(mouse.UnitRay.Origin,mouse.UnitRay.Direction*50000)
)
if target then
if find_parent(target) then
print('yes')
end
end
end)
this code will work if the mouse is hovering over the persons legs but otherwise will just not print yes is there a better way todo this?
thanks, ira

2 comments
bruh youre calling a function with an infinite while loop every pixel the mouse moves... not good.
yes, but the loop will only run 2 or 3 times max i really can't think of any better way to do this.