|
| 22 Sep 2015 01:18 AM |
-- (i am new at this, this is a hopperbin tool in starter pack)
player = game.Players.LocalPlayer
m = player:GetMouse()
Punch = script:WaitForChild("Punch")
tool = script.Parent
Rarm = player.Character["Right Arm"]
arm = Rarm
local damage = 5
tool.Selected:connect(function(m) m.Button1Down:connect(function() local animateTrack = player.Character.Humanoid:LoadAnimation(Punch) animateTrack:Play() end) end)
arm.Touched:connect(function() if equipped and character and humaniod and humanoid.Health > 0 and hit and not hit:isDescendantOf(character) then local targethumaniod = hit.Parent:findFirstChild("Humaniod") if targethumanoid and targethumanoid.Health > 0 then targethumaniod:TakeDamage(damage) end end end)
|
|
|
| Report Abuse |
|
|
|
| 22 Sep 2015 06:02 AM |
| Honestly instead of using a HopperBin, why don't you use the UserInputService and make the player hit a key on the keyboard for the function to happen? |
|
|
| Report Abuse |
|
|
Csharp0
|
  |
| Joined: 05 Mar 2015 |
| Total Posts: 261 |
|
|
| 22 Sep 2015 06:19 AM |
First of all use Tools, they don't require handles anymore.
Is that a localscript? |
|
|
| Report Abuse |
|
|
Csharp0
|
  |
| Joined: 05 Mar 2015 |
| Total Posts: 261 |
|
|
| 22 Sep 2015 06:22 AM |
If it isn't a localscript then this will instantly cause it to not work:
player = game.Players.LocalPlayer
If it is a localscript then it shouldn't be because then changes will only happen for the player who runs the script. |
|
|
| Report Abuse |
|
|