Rit957
|
  |
| Joined: 19 Apr 2011 |
| Total Posts: 3459 |
|
|
| 26 Jan 2013 11:49 AM |
I am trying to make the simplest kill script ever but this one only works once
function onTouched(h) h.Parent.Humanoid.Health=0
end
connection = script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
|
| 26 Jan 2013 11:54 AM |
script.Parent.Touched(function(hit) if hit.Parent:findFirstChild("Humanoid") then hit.Parent.Humanoid.Health = 0 end end) |
|
|
| Report Abuse |
|
|
As8D
|
  |
| Joined: 24 Dec 2009 |
| Total Posts: 2907 |
|
|
| 26 Jan 2013 12:00 PM |
Cody, remember missiles. hit.Parent can be nil! (Or... I think instant using the parent's method will work. Maybe it's just me, but if this is true, then I guess that there's a little delay when removing/destroying objects. Or that may just be in the script's code. Nvm.)
But yesh, Cody solved daz problemos.
- As. Why did I even visit http://roblox.com/user.aspx?id=1 in the first place? Dunno. |
|
|
| Report Abuse |
|
|
TacoBowls
|
  |
| Joined: 02 Mar 2009 |
| Total Posts: 112 |
|
|
| 26 Jan 2013 12:00 PM |
function onTouched(part) local h = part.Parent:findFirstChild("Humanoid") if h~=nil then h.Health = 0 end end script.Parent.Touched:connect(onTouched)
I'm guessing its a brick, when touched, kills the person. If so, this would be the correct way. You forgot to define 'h' by the way. |
|
|
| Report Abuse |
|
|
|
| 26 Jan 2013 12:03 PM |
"You forgot to define 'h' by the way."
>function onTouched(h) |
|
|
| Report Abuse |
|
|
TacoBowls
|
  |
| Joined: 02 Mar 2009 |
| Total Posts: 112 |
|
|
| 26 Jan 2013 12:11 PM |
Wasn't paying attention because I changed it to (part) . My bad.. But thanks for the notice. |
|
|
| Report Abuse |
|
|
boomin3
|
  |
| Joined: 06 Mar 2010 |
| Total Posts: 87 |
|
| |
|