gogo6104
|
  |
| Joined: 10 Feb 2010 |
| Total Posts: 326 |
|
|
| 07 Jul 2017 12:10 PM |
I already have the script along the lines of:
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
mouse.Button1Down:connect(function() if mouse.Target and mouse.Target.Parent:FindFirstChild("Humanoid") then local playerFound = mouse.Target.Parent.Name print(playerFound) end end)
^ That script should print the name of the player you clicked; if I click another player, that should find whatever I clicked of them (torso, left arm, etc), find it's parent, and grab it's name (Which obviously should be the model which is the player's name), then print it.
This works, kinda. It's only detecting it if I click certain parts of the player. I have to keep rapidly clicking all over the player's body before finally finding a spot where the mouse.Target detects the humanoid; what am I doing wrong? Is there like a natural way that your mouse.Target goes through a character's body or something? Please help, thanks!
~ Masked_Beanie |
|
|
| Report Abuse |
|
Thedagz
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 798 |
|
|
| 07 Jul 2017 12:13 PM |
You might of clicked on the hat
so try this
if mouse.Target and mouse.Target.Parent:FindFirstChild("Humanoid") or mouse.Target.Parent.Parent:FindFirstChild("Humanoid") then |
|
|
| Report Abuse |
|
Thedagz
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 798 |
|
|
| 07 Jul 2017 12:13 PM |
| also do print(mouse.Target) if it glitches so you can see what its clicking |
|
|
| Report Abuse |
|