I have a script that makes it where when you left click on a NPC or player, it will print their name. For example, if you target a NPC named "Bob", it will print "Bob." If you click on a player with the name of "targetMe123," it will print "targetMe123." The only problem is, with the current code I have, it's only working on NPCs and not players.
Here's my code that I have:
mouse.ButtonDown1:connect(function()
if mouse.Target ~= nil and mouse.Target.Parent.Humanoid then
local currentTarget = mouse.Target.Parent.Name
print(currentTarget)
end
end)

4 comments
What's it printing instead?
I found out the problem. You see, the player torso and head have Collide = false. It will print their names if they click the arms or legs. Now I'm wondering, is there a way I can keep the torso and head the same but not click right through them? Like clicking a non collidable block?
maybe add a new block on the position of the torso and head and weld it to them?
Okay, I'll try that. Thanks