deer536
|
  |
| Joined: 13 Oct 2016 |
| Total Posts: 39 |
|
|
| 17 May 2017 08:49 PM |
function onTouched(hit) local human = hit.Parent:FindFirstChild("Humanoid") --Basically this just checks to see if it is a real player touching this brick. if (human ~= nil) then --If it is a real player, then DESTROY THEM! human.Health = 0 --Your Health Is Now 0. end end
if (script.Parent ~= nil) and (script.Parent.className == "Part") then --Work if in a block connection = script.Parent.Touched:connect(onTouched) end
|
|
|
| Report Abuse |
|
|
|
| 17 May 2017 08:55 PM |
Why not just do:
script.Parent.Touched:connect(function(x) if x.Parent:FindFirstChild('Humanoid') then x.Parent:BreakJoints() end end)
~MightyDantheman~ |
|
|
| Report Abuse |
|
|
LinkMe
|
  |
| Joined: 30 Apr 2009 |
| Total Posts: 512 |
|
| |
|
|
| 17 May 2017 08:59 PM |
It'll work, but you should try to be as efficient as possible. Of course, if one is just trying to get a prototype going, then efficiency can come later.
~MightyDantheman~ |
|
|
| Report Abuse |
|
|
deer536
|
  |
| Joined: 13 Oct 2016 |
| Total Posts: 39 |
|
| |
|