generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: "Unexpected Symbol"

Previous Thread :: Next Thread 
drew8732 is not online. 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 is not online. 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 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
10 Jan 2013 03:23 PM
Parent.Humanoid.Died:wait()
Report Abuse
miz656 is not online. 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 is not online. 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 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
10 Jan 2013 03:25 PM
Depends where the script is.
Report Abuse
drew8732 is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image