local mouse = game.Players.LocalPlayer:GetMouse() local p = workspace.part local plr = "Head" while true do wait() if mouse.Target == nil or mouse.Target == p then script.Parent.Value = "" elseif mouse.Target == plr then script.Parent.Value = plr.Parent.Name else script.Parent.Value = mouse.Target.Name end end
Everything works except elseif mouse.Target == plr then
script.Parent.Value = plr.Parent.Name
Whenever I mouse over a head the value is 'Head' and not 'Player1' (the head belongs to 'Player1')
No errors either.
elseif mouse.Target == plr then
You are trying to compare a string value plr ( ="Head") to an actual object. Try with this:
elseif mouse.Target.Name == plr then script.Parent.Value = mouse.Target.Parent.Name