|
| 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
|
  |
| 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 |
|
|
| |
|
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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|