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: Can't get AI's health past one hundred?

Previous Thread :: Next Thread 
Tecara is not online. Tecara
Joined: 26 Jul 2012
Total Posts: 145
28 May 2014 01:07 PM
I try to do a health fix script that looks like this:

wait(1)
local hum = script.Parent.Humanoid
hum.Health = hum.MaxHealth

the MaxHealth is 500 but, whenever I test it out, the health automatically goes to 100. Any help solving this is appreciated. :)
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
28 May 2014 01:07 PM
wait(1)
local hum = script.Parent.Humanoid
hum.MaxHealth = 500
hum.Health = 500
--idk, just to be certain?
Report Abuse
samy22 is not online. samy22
Joined: 28 Sep 2008
Total Posts: 2181
28 May 2014 01:09 PM
Is there a script/ health script making sure the Health doesn't go past it's max health?
Report Abuse
planesoldier is not online. planesoldier
Joined: 26 Sep 2010
Total Posts: 533
28 May 2014 01:15 PM
function waitForChild(parent, childName)
while true do
local child = parent:findFirstChild(childName)
if child then
return child
end
parent.ChildAdded:wait()
end
end



local Figure = script.Parent
local Head = waitForChild(Figure, "Head")
local Humanoid = waitForChild(Figure, "Humanoid")
Humanoid.Health=100 -- Change 100 to the Maximum Health, the Script will do the Rest :D

while true do
local s = wait(4)
local health = Humanoid.Health
if health > 0 and health < Humanoid.MaxHealth then
health = health + 0.08 * s * Humanoid.MaxHealth
if health * 1.05 < Humanoid.MaxHealth then
Humanoid.Health = health
else
Humanoid.Health = Humanoid.MaxHealth
end
end
end
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