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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Why doesn't this work?

Previous Thread :: Next Thread 
Wonc is not online. Wonc
Joined: 27 Jul 2010
Total Posts: 60
18 Apr 2013 06:37 PM
I have this script that checks the Zombie's health to see if it's 0 and then sets the Value of BossDead to 1 if it hits zero but it doesn't seem to work at all. Any ideas?

i = 0
health = script.Parent.Health
while i = 0 do
if health <= 0 then
game.Workspace.BossDead.Value = 1
end
end
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
18 Apr 2013 06:38 PM
"health" will always be what it was when the script first fired. You also would need two equal signs to check whatever. Also, it would best to use the .Died event.

    script.Parent.Died:connect(function()
      Workspace.BossDead.Value = 1
    end )

(╯°□°)> KMXD
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
18 Apr 2013 06:39 PM
i = 0
health = script.Parent.Health
while i == 0 do--comparing i to 0
wait()--add a wait()
if health <= 0 then
game.Workspace.BossDead.Value = 1
end
end
Report Abuse
dog456pop248 is not online. dog456pop248
Joined: 24 Aug 2008
Total Posts: 3977
18 Apr 2013 06:39 PM
Use Zombie.Humanoid.Died
Report Abuse
Wonc is not online. Wonc
Joined: 27 Jul 2010
Total Posts: 60
18 Apr 2013 06:52 PM
I still can't seem to get it to work, what would I be replacing with

script.Parent.Died:connect(function()
Workspace.BossDead.Value = 1
end )
Report Abuse
dog456pop248 is not online. dog456pop248
Joined: 24 Aug 2008
Total Posts: 3977
18 Apr 2013 06:54 PM
Is the script inside of the humanoid?
Report Abuse
Wonc is not online. Wonc
Joined: 27 Jul 2010
Total Posts: 60
18 Apr 2013 06:56 PM
Yeah, is that bad?
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
18 Apr 2013 06:59 PM
while wait(0.03) do
if script.Parent.Health <= 0 then
game.Workspace.BossDead.Value = 1
end
end


Although, once its health is 0, it will :BreaJoints() so setting its health to one will do nothing
Report Abuse
Wonc is not online. Wonc
Joined: 27 Jul 2010
Total Posts: 60
18 Apr 2013 07:02 PM
UnBuild, it works perfectly thank you! Thanks everyone, I've been struggling with this one for a while haha.
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