|
| 20 Oct 2012 01:47 PM |
=== Script: [ Remove ]===
while true do wait(5) if script.Parent.Humanoid.Health<1 then script.Parent:remove() end end
=== Output ===
13:35:36 - Workspace.Zombie.[ Remove ]:3: attempt to index field 'Parent' (a nil value) 13:35:36 - Script "Workspace.Zombie.[ Remove ]", Line 3 13:35:36 - stack end
=== Problem ===
Script works fine. It's doing everything it's supposed to do. After 5 seconds this output comes up.
Can anyone explain what's happening? The script is working fine it's just that this output keeps coming up. Since I am stating a fresh game I would like my game process to be flawless. Thanks! |
|
|
| Report Abuse |
|
|
|
| 20 Oct 2012 01:51 PM |
Starting*
This script is supposed to remove the zombie without respawning. |
|
|
| Report Abuse |
|
|
| |
|
|
| 20 Oct 2012 02:03 PM |
| There's not a problem with the script since it does what its supposed to do |
|
|
| Report Abuse |
|
|
|
| 20 Oct 2012 02:05 PM |
Instead of > 1 use,
if script.Parent.Humanoid.Health ~= nil then
nil = 0 ~= not equal to
Hope this helps! |
|
|
| Report Abuse |
|
|
|
| 20 Oct 2012 02:08 PM |
I don't think it helps since you are saying there is:
If Health is not equal to 0, remove it.
So whenever the zombie has like 50 health it removes it.
So it's not really going to help.
Thank you though! :D |
|
|
| Report Abuse |
|
|
|
| 20 Oct 2012 02:13 PM |
| Hmm, this is weird. Nothing is supposed to come out. |
|
|
| Report Abuse |
|
|
|
| 20 Oct 2012 02:18 PM |
Try,
if script.Parent.Humanoid.Health =< 1 then |
|
|
| Report Abuse |
|
|
|
| 20 Oct 2012 02:27 PM |
| Hmm but I don't think the problem is located there. The script works! I would like to know why is there an output coming out and how to fix this. |
|
|
| Report Abuse |
|
|
|
| 20 Oct 2012 02:31 PM |
Try this:
script.Parent.Humanoid.Died:connect(function() script.Parent:Destroy() end) |
|
|
| Report Abuse |
|
|
|
| 20 Oct 2012 02:33 PM |
| :remove() to changed into :Destroy() for some reason btw |
|
|
| Report Abuse |
|
|
|
| 20 Oct 2012 02:39 PM |
| Thanks! Let me try it out. I'll get back to you with the results. |
|
|
| Report Abuse |
|
|
|
| 20 Oct 2012 02:56 PM |
@TheDeath
Thank you so much your solution worked!! :D! Thank you!
@TheColor
It did work but the output kept appearing.
Thank you guys! :D |
|
|
| Report Abuse |
|
|