|
| 22 Oct 2011 08:06 AM |
local laser = script.Parent function onTouched(hit) local h = hit.Parent:FindFirstChild("Humanoid") if (h ~= nil and hit.Name ~= "bang" and hit.Name ~= "bang2") then h:TakeDamage(10) laser:Remove() else laser:Remove() end end script.Parent.Touched:connect(onTouched)
So basically I am shooting this at a Humanoid. Not a player, it's a working Humanoid, know what I mean? Anyway, it isn't damaging, so I'm puzzled. Anyone help please?
> Note: The Humanoid does not have a forcefield |
|
|
| Report Abuse |
|
|
|
| 22 Oct 2011 08:09 AM |
TakeDamage? Not a function... change to h.Health = 90
Hope it works?? |
|
|
| Report Abuse |
|
|
|
| 22 Oct 2011 08:13 AM |
| Skipper :TakeDamage() is a method and it works. |
|
|
| Report Abuse |
|
|
bourlo
|
  |
| Joined: 11 Aug 2009 |
| Total Posts: 399 |
|
|
| 22 Oct 2011 08:13 AM |
| i dont know maybe it shouldnt be local |
|
|
| Report Abuse |
|
|
|
| 22 Oct 2011 08:14 AM |
local laser = script.Parent function onTouched(hit) local h = hit.Parent:FindFirstChild("Humanoid") if h and hit.Parent.Name == "Bang" and hit.Parent.Name == "Bang2" then h:TakeDamage(10) laser:Remove() else laser:Remove() end end script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
|
| 22 Oct 2011 08:15 AM |
| Oh. Sorry, I didn't read about TakeDamage. Sorry! Just read on wiwki, it should work. =\ |
|
|
| Report Abuse |
|
|
|
| 22 Oct 2011 08:16 AM |
Maybe you should replace it with
for i = 100,90,-10 do h.Health = i end
=\ |
|
|
| Report Abuse |
|
|
|
| 22 Oct 2011 08:17 AM |
| That would kill the human when the bullet hits the first time. |
|
|
| Report Abuse |
|
|
eSvena
|
  |
| Joined: 11 Aug 2011 |
| Total Posts: 75 |
|
|
| 22 Oct 2011 08:34 AM |
| Yea, this script will be executed 10 time ( 100 - 90 = 10 ) and all the time, the script will do -10 then -10*10 = -100 ^^ |
|
|
| Report Abuse |
|
|
eSvena
|
  |
| Joined: 11 Aug 2011 |
| Total Posts: 75 |
|
|
| 22 Oct 2011 08:36 AM |
Or, you can use that :
Humanoid.Health = Humanoid.Health - 10
^^ |
|
|
| Report Abuse |
|
|
NBCKing
|
  |
| Joined: 09 Oct 2011 |
| Total Posts: 133 |
|
|
| 22 Oct 2011 08:52 AM |
| Usually, I use output, so I see whats wrong, so I can just post the area thats wrong. |
|
|
| Report Abuse |
|
|
|
| 22 Oct 2011 08:56 AM |
You are all WRONG.
Bikerking, you just added another end and made the 'bang's Bang. So now that won't work. Output obviously doesn't show anything. And a bunch of other stuff. Can somebody just actually fix this other than discussing it? T.T |
|
|
| Report Abuse |
|
|
|
| 22 Oct 2011 08:59 AM |
d = 10
h:TakeDamage(d)
Should work. |
|
|
| Report Abuse |
|
|
|
| 22 Oct 2011 09:00 AM |
| I was going to 'actually fix' it but nvm because if you actually looked into my code it would say 'if h and hit.Parent.Name == "Bang" and hit.Parent.Name == "Bang2" then' And that probably would of worked so ya now im not going to help you because you 1) Yelled at me. 2) You said that I just added 1 more end when I didnt. 3) You`re a noob and get out. |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 22 Oct 2011 09:04 AM |
Skipper, the difference between TakeDamage() and just subtracting ones health is that the TakeDamage() method wouldn't affect the health of one if they have a spawn shield.
<'+1 Post. Ujelly?'>
|
|
|
| Report Abuse |
|
|
|
| 31 Oct 2011 07:16 AM |
| Make me get out. Also, Output didn't like your script. |
|
|
| Report Abuse |
|
|