1 | local mouse = game.Players.LocalPlayer:GetMouse() |
2 |
3 | if mouse.Target ~ = nil then |
4 | if mouse.Target.Parent:FindFirstChild( "Humanoid" ) then |
5 | print ( "FOUND HIM!" ) |
6 | end |
7 | end |
doesn't tell me anything, that's all of the code by the way.
In some instances, if you targeted a players hat, the parent would be Head, which does not contain a Humanoid, if you want to find the humanoid, here is an example:
01 | function FindBase(top) |
02 | --you could upvalue workpace or use the preset global variable Workspace/workspace |
03 | local workspace = game:GetService( "Workspace" ) |
04 |
05 | while (top.Parent ~ = workspace) do |
06 | top = top.Parent |
07 | --could add wait, if you wanted |
08 | end |
09 | return top |
10 | end |
11 |
12 | local mouse = game.Players.LocalPlayer:GetMouse() |
13 |
14 | if mouse.Target ~ = nil then |
15 | local base = FindBase(mouse.Target) |
16 | if (base:FindFirstChild( "Humanoid" )) then |
17 | print ( "Gotem coach" ) |
18 | end |
19 | end |