Kasumo
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 2467 |
|
|
| 12 Jan 2014 02:14 PM |
I want the sword to take away humanoid's MaxHealth divided by 5 when it is swung, can someone help me implement that?
enabled = true Tool = script.Parent local Animations = { [1] = Tool.RightSlash, [2] = Tool.LeftSlash, } Tool.Activated:connect(function(mouse) if enabled then local player = game.Players.LocalPlayer local huma = player.Character:findFirstChild("Humanoid") local anim = huma:LoadAnimation(Animations[math.random(1, #Animations)]) wait() anim:Play() --[Damage]-- enabled = false wait(1) enabled = true end end)
|
|
|
| Report Abuse |
|
|
Kasumo
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 2467 |
|
| |
|
|
| 12 Jan 2014 02:36 PM |
the line would be humanoid.Health = humanoid.Health/5 i can't see the exact code anymore cause of the bump post but you would need to have local humanoid = hit.Parent:Findfirstchild("Humanoid")--define the humanoid if humanoid and humanoid.Parent~= script.Parent.Parent--then-verify there is a humanoid and its not the holder
type of thing |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2014 02:38 PM |
o wait it would be damage = huma.Health/5 Humanoid:TakeDamage(damage) disregard the previous post |
|
|
| Report Abuse |
|
|
Kasumo
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 2467 |
|
|
| 12 Jan 2014 02:57 PM |
| The problem with that is, when the player swings, it takes multiple amounts of damage, like it doesn't have a debounce, when it does. |
|
|
| Report Abuse |
|
|
Kasumo
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 2467 |
|
| |
|
Kasumo
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 2467 |
|
|
| 12 Jan 2014 05:01 PM |
| Nevermind I fixed it...lazy PEOPLE. >;3 |
|
|
| Report Abuse |
|
|