|
| 08 Mar 2014 09:27 AM |
If I do the basic method of:
script.Parent.Hit:connect(function(hit)
end)
But the thing that hit it is not an actual humanoid, for example a brick falls on top of it. Will it still run the function, or will it not? |
|
|
| Report Abuse |
|
|
Marolex
|
  |
| Joined: 17 Dec 2012 |
| Total Posts: 1785 |
|
|
| 08 Mar 2014 09:28 AM |
Yes it will. add this in after the function line
if hit.Parent:FindFirstChild("Humanoid") then |
|
|
| Report Abuse |
|
|
|
| 08 Mar 2014 09:32 AM |
Do what Marolex said, but since you are using the touched event, I suggest adding a debounce.
Also, if you have non-player humanoids in your place, and you want the function to only run on the players, try this:
script.Parent.Hit:connect(function(hit) local p = game.Players:GetPlayerFromCharacter(h.Parent) if p then
--Do stuff here
end end) |
|
|
| Report Abuse |
|
|