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 » Building Helpers
Home Search
 

Re: Health and Humanoids

Previous Thread :: Next Thread 
ThePixeled is not online. ThePixeled
Joined: 07 Oct 2012
Total Posts: 73
06 Nov 2014 02:40 PM
I have an NPC with 1000 MaxHealth
I set its regular Health to 1000 and it sets itself to 100
How do I fix that?
Report Abuse
TheyreTheirThere is not online. TheyreTheirThere
Joined: 10 Oct 2014
Total Posts: 622
06 Nov 2014 03:27 PM
Put this script in the npc







local Figure = script.Parent
local Head = Figure:WaitForChild("Head")
local Humanoid = Figure:WaitForChild("Humanoid")
local regening = false


function regenHealth()
if regening then return end
regening = true

while Humanoid.Health < Humanoid.MaxHealth do
local s = wait(1)
local health = Humanoid.Health
if health > 0 and health < Humanoid.MaxHealth then
local newHealthDelta = 0.01 * s * Humanoid.MaxHealth
health = health + new
Humanoid.Health = math.min(health,Humanoid.MaxHealth)
end
end

if Humanoid.Health > Humanoid.MaxHealth then
Humanoid.Health = Humanoid.MaxHealth
end

regening = false
end

Humanoid.HealthChanged:connect(regenHealth)
Report Abuse
TheyreTheirThere is not online. TheyreTheirThere
Joined: 10 Oct 2014
Total Posts: 622
06 Nov 2014 03:29 PM
hmmm nvm that didnt work
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Building 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