Dashspin
|
  |
| Joined: 05 Aug 2010 |
| Total Posts: 6152 |
|
|
| 15 Jul 2012 06:26 PM |
I'm trying to edit a kill script so it doesn't effect zombies but it won't work. It just doesn't do anything. Doesn't work on the player OR the zombie. My hunch is that I did something wrong. Tell me how to fix it, please.
function onTouched(hit) if not hit or not hit.Parent then return end local human = hit.Parent:findFirstChild("Humanoid") if human and human:IsA("Humanoid") then human:takeDamage(100) if hit.Parent == ["Zombie"] nil then -- this is the only line I changed end end
It worked before I added that one line. What did I do wrong? Fix it for me please.
|
|
|
| Report Abuse |
|
|
|
| 15 Jul 2012 06:30 PM |
| Well, for one, you put two "if"s. Elseif is better. :D |
|
|
| Report Abuse |
|
|
Dashspin
|
  |
| Joined: 05 Aug 2010 |
| Total Posts: 6152 |
|
|
| 15 Jul 2012 06:31 PM |
| Okay so I just need to change the second if to elseif? Okay, thanks. |
|
|
| Report Abuse |
|
|
|
| 15 Jul 2012 06:32 PM |
| Most likely more than that. I can't concentrate. |
|
|
| Report Abuse |
|
|
|
| 15 Jul 2012 06:33 PM |
What is this line for?
if not hit or not hit.Parent then return end
|
|
|
| Report Abuse |
|
|
|
| 15 Jul 2012 06:35 PM |
Get rid of the line you used and use something such as `local human = hit.Parent:FindFirstChild("Humanoid") or hit.Parent:FindFirstChild("Zombie")`, which will try to find a humanoid named `Zombie` if a `Humanoid` isn't found.
I think this is what you're trying to do anyways. |
|
|
| Report Abuse |
|
|
Dashspin
|
  |
| Joined: 05 Aug 2010 |
| Total Posts: 6152 |
|
|
| 15 Jul 2012 06:36 PM |
| I have no idea. I just copied the script from ROBLOX's stamper spikes and added a line. XD |
|
|
| Report Abuse |
|
|
Dashspin
|
  |
| Joined: 05 Aug 2010 |
| Total Posts: 6152 |
|
|
| 15 Jul 2012 06:42 PM |
| @Scar Adding one of those lines would find the zombie, but I want it to remove the effects of the kill script for the zombie. |
|
|
| Report Abuse |
|
|