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: Damage on touch script help

Previous Thread :: Next Thread 
WaddelsGaming is not online. WaddelsGaming
Joined: 08 Oct 2013
Total Posts: 90
22 Jan 2016 03:22 PM
So basically I took the original kill brick that would kill you
if you touch the brick but what I want is if the player touches the brick
they just get damaged.I tried editing the script and I did this:

script.Parent.Touched:connect(function(hit)
if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid.Health = -10
end
end)

But when the player hits the brick it kills them instantly
but it's supposed to take 10 health off the player.Help?
Report Abuse
FrostOver is not online. FrostOver
Joined: 20 Jun 2013
Total Posts: 299
22 Jan 2016 03:35 PM
you're making his health -10 you need to subtract ten from his health
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 10
Report Abuse
WaddelsGaming is not online. WaddelsGaming
Joined: 08 Oct 2013
Total Posts: 90
22 Jan 2016 04:23 PM
OHHHHHHHHH
Thx!
Report Abuse
Aethex is not online. Aethex
Joined: 16 Oct 2011
Total Posts: 2193
22 Jan 2016 04:25 PM
use the TakeDamage() method instead: http://wiki.roblox.com/index.php?title=API:Class/Humanoid/TakeDamage
Report Abuse
Scerzy is not online. Scerzy
Joined: 27 Dec 2010
Total Posts: 1082
22 Jan 2016 04:28 PM
hit.Parent.TakeDamage=10

much simpler but either one works


Report Abuse
Aethex is not online. Aethex
Joined: 16 Oct 2011
Total Posts: 2193
22 Jan 2016 04:31 PM
@Scerzy that's not how you use TakeDamage

it's a method, not a property
Report Abuse
Scerzy is not online. Scerzy
Joined: 27 Dec 2010
Total Posts: 1082
22 Jan 2016 04:33 PM
hit.Parent.Humanoid:TakeDamage(10)

Hardly a difference I'm sure he would've figured it out


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