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 » Scripters
Home Search
 

Removes parent if "Health" value is below 0

Previous Thread :: Next Thread 
SpecialistSuperPig is not online. SpecialistSuperPig
Joined: 19 Mar 2011
Total Posts: 61
07 Oct 2016 01:55 PM
There's a value in my model called "health", which goes down when blocks within the model get shot. I need a script to remove its parent after it goes below 0.

I appriciate any help :I
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
07 Oct 2016 02:35 PM
if health <= 0
destroy parent
Report Abuse
jordan0810 is not online. jordan0810
Joined: 03 Jun 2012
Total Posts: 846
07 Oct 2016 03:23 PM
#################################################################################################################
Report Abuse
vexieh is not online. vexieh
Joined: 22 Oct 2009
Total Posts: 3468
07 Oct 2016 03:27 PM
if(script.Parent.Health.Value <= 0)then
script.Parent:Destroy() --or script.Parent:remove()
end


Report Abuse
Sarcasmed is not online. Sarcasmed
Joined: 17 May 2013
Total Posts: 15201
07 Oct 2016 03:47 PM
############################################################
Report Abuse
Kie413Games is not online. Kie413Games
Joined: 06 May 2010
Total Posts: 3896
07 Oct 2016 04:04 PM
health.Changed:connect(function() -- not sure if this will work or you have to do .Value
if health.Value < 0 then
script.Parent:Remove() -- Could use :Destroy() but you said remove so..
end
end)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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