|
| 21 Dec 2013 02:10 AM |
bin = script.Parent backpack = bin.Parent player = backpack.Parent while not player.Character do wait() end--not sure what this is for character = player.Character
bin.Selected:connect(function(mouse) mouse.Button1Down:connect(function() local target = mouse.Target if target:IsA("Model") and target:FindFirstChild("Humanoid") ~= nil then target.Humanoid.Health = 0 end end) end)
|
|
|
| Report Abuse |
|
|
| |
|
|
| 21 Dec 2013 03:04 AM |
Here is a working version: script.Parent.Selected:connect(function(mouse) mouse.Button1Down:connect(function() if(mouse.Target) and (mouse.Target.Parent:FindFirstChild("Humanoid")) then mouse.Target.Parent.Humanoid.Health = 0 end end) end)
You forgot to go to the parent. |
|
|
| Report Abuse |
|
|