drew8732
|
  |
| Joined: 01 Apr 2010 |
| Total Posts: 1965 |
|
|
| 10 Jan 2013 03:18 PM |
I'm trying to make a dead body removal script that goes into an NPC. So, if a mean player kills the helpless NPC, it dies, and then its body is removed seconds later. (More for the purpose of removing lag.) But when I start up a solo game, the output says "Unexpected symbol near '['." I feel bad making two consecutive posts here, but, I just don't know. @_@ It's probably a simple fix like any other time I have trouble, but, thanks.
if Parent.Humanoid.Health == 0 then wait(5) script.Parent:Destroy() end |
|
|
| Report Abuse |
|
|
weman103
|
  |
| Joined: 10 Aug 2008 |
| Total Posts: 62 |
|
|
| 10 Jan 2013 03:21 PM |
| Change "if Parent.Humanoid.Health == 0 then" to "if script.Parent.Humanoid.Health == 0 then" |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 10 Jan 2013 03:23 PM |
Parent.Humanoid.Died:wait()
|
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 10 Jan 2013 03:24 PM |
script.Parent.Humanoid.Died:wait()
What I meant ;P |
|
|
| Report Abuse |
|
|
drew8732
|
  |
| Joined: 01 Apr 2010 |
| Total Posts: 1965 |
|
|
| 10 Jan 2013 03:25 PM |
| Would that work if there's going to be multiple NPC's? Because otherwise wouldn't I have to put this script in Workspace? Not trying to be picky, I'm just unsure and it doesn't hurt to ask. :P |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 10 Jan 2013 03:25 PM |
| Depends where the script is. |
|
|
| Report Abuse |
|
|
drew8732
|
  |
| Joined: 01 Apr 2010 |
| Total Posts: 1965 |
|
|
| 10 Jan 2013 03:25 PM |
| Whoops, you posted while I was typing my last post. Thanks. I'll give both scripts a try. |
|
|
| Report Abuse |
|
|
weman103
|
  |
| Joined: 10 Aug 2008 |
| Total Posts: 62 |
|
|
| 10 Jan 2013 03:30 PM |
If there are going to be multiple, then do something like this and put it in workspace(I'm terrible with these kinds of scripts though)
while true do for _,v in pairs(game.Workspace:GetChildren()) do if v.Name == "NPC" and v:FindFirstChild("Humanoid") then if v.Humanoid.Health == 0 then v:remove() end end end wait() end |
|
|
| Report Abuse |
|
|
drew8732
|
  |
| Joined: 01 Apr 2010 |
| Total Posts: 1965 |
|
|
| 10 Jan 2013 03:31 PM |
| It didn't work. Is "Died" a value in Humanoids? |
|
|
| Report Abuse |
|
|