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
 

Re: if a humanoid's health is 25 or below the script works?

Previous Thread :: Next Thread 
xLawOut is not online. xLawOut
Joined: 28 Feb 2015
Total Posts: 1782
26 Feb 2017 12:05 PM
function onTouched(part) local h = part.Parent:findFirstChild("Humanoid") if h~=nil then h.Health = 20 wait(45) h.Health = 15 wait(45) h.Health = 10 wait(45) h.Health = 5 wait(45) h.Health = 0 end end script.Parent.Touched:connect(onTouched) I have this script. it's supposed to work ONLY when the humanoid's health is 25 or below. it's linked to a bleeding script for my game. so if the player has low health and gets damaged again he slowly dies off if he doesn't get his health back up to higher than 25. it's a 1 line of code and I can't seem to ## ####
Report Abuse
xLawOut is not online. xLawOut
Joined: 28 Feb 2015
Total Posts: 1782
26 Feb 2017 12:06 PM
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
h.Health = 20
wait(45)
h.Health = 15
wait(45)
h.Health = 10
wait(45)
h.Health = 5
wait(45)
h.Health = 0
end
end

script.Parent.Touched:connect(onTouched)

I have this script.

it's supposed to work ONLY when the humanoid's health is 25 or below.

it's linked to a bleeding script for my game.



so if the player has low HP and gets damaged again he slowly dies off if he doesn't get his health back up to higher than 25.


it's a 1 line of code and I can't seem to make it..


Report Abuse
IcedVapour is not online. IcedVapour
Joined: 10 Nov 2013
Total Posts: 2741
26 Feb 2017 12:08 PM
if h~=nil and h.Health < 25 then
Report Abuse
xLawOut is not online. xLawOut
Joined: 28 Feb 2015
Total Posts: 1782
26 Feb 2017 12:10 PM
I KNEW IT HAD TO DO WITH "h. Health = <25 then"!

well anyways thanks.

also this makes me feel stupid now..


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