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: How could I find a player's health?

Previous Thread :: Next Thread 
Programmer101 is not online. Programmer101
Joined: 27 Jul 2009
Total Posts: 1043
11 Mar 2012 05:15 PM
For instance, I want to be able to make something happen to a player when he touches a brick and has a health of less then 10... how could I accomplish this?
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
11 Mar 2012 05:16 PM
if [However you get to the character].Humanoid.Health <= Number then
...
end
Report Abuse
bl5eebryce is not online. bl5eebryce
Joined: 03 Aug 2009
Total Posts: 387
11 Mar 2012 05:20 PM
script.Parent.Touched:connect(function(hit)
if hit.Parent:findFirstChild("Humanoid") then
if hit.Parent:findFirstChild("Humanoid").Health < 10 then
hit:Destroy()
end
end
end)
Report Abuse
bl5eebryce is not online. bl5eebryce
Joined: 03 Aug 2009
Total Posts: 387
11 Mar 2012 05:21 PM
Dang it. Hate doin this on an iPad.
Report Abuse
RobloxNewb01 is not online. RobloxNewb01
Joined: 16 Apr 2011
Total Posts: 348
11 Mar 2012 05:33 PM
script.Parent.Touched:connect(becky)
b = becky.Parent:findFirstChild("Humanoid")
if b ~= nil then -- If b is not equal to nothing
b:TakeDamage(100)
end
end)
Report Abuse
RobloxNewb01 is not online. RobloxNewb01
Joined: 16 Apr 2011
Total Posts: 348
11 Mar 2012 05:45 PM
Oh wait nvm hold on:

script.Parent.Touched:connect(becky)
b = becky.Parent:findFirstChild("Humanoid")
if b ~= nil then
m = Instance.new("Message", workspace)
m.Text = "Who ever touched me's health is " .. b.Health
wait(5)
m:remove()
end
end)
Report Abuse
RobloxNewb01 is not online. RobloxNewb01
Joined: 16 Apr 2011
Total Posts: 348
11 Mar 2012 05:51 PM
fix script.Parent.Touched:connect(becky) to script.Parent.Touched:connect(function(becky)
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