Tiberiuoctavian

Punch Script

Jun 23rd, 2018
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. local plr = game.Players.LocalPlayer
  2. local char = plr.Character or plr.CharacterAdded:wait()
  3. local UIS = game:GetService('UserInputService')
  4. local candmg = false
  5. local debounce = true
  6.  
  7. --repeat wait() until char
  8. --repeat wait() until char.Humanoid
  9.  
  10. local part = Instance.new('Part', char)
  11. part.Transparency = 1
  12. part.Size = Vector3.new(1,1,1)
  13. part.Name = 'Part'
  14. part.Anchored = false
  15. part.CanCollide = false
  16.  
  17. part.CFrame = CFrame.new(char.UpperTorso.Position + Vector3.new(-1,0,-1))
  18. local weld = Instance.new('Weld', part)
  19. weld.C0 = char.UpperTorso.CFrame:inverse() * part.CFrame
  20. weld.Part0 = char.UpperTorso
  21. weld.Part1 = part
  22. part.Orientation = Vector3.new(0,0,0)
  23.  
  24. UIS.InputBegan:connect(function(input)
  25. if debounce == true then
  26. if char:WaitForChild('Humanoid').Health ~= 0 then
  27. if input.KeyCode == Enum.KeyCode.E then
  28. local punch = char.Humanoid:LoadAnimation(script.Punch)
  29. punch:Play()
  30. debounce = false
  31. candmg = true
  32. wait(.01)
  33. wait(.4)
  34. debounce = true
  35. wait(.1)
  36. candmg = false
  37. end
  38. end
  39. end
  40. end)
  41.  
  42. UIS.InputBegan:connect(function(input)
  43. if debounce == true then
  44. if char:WaitForChild('Humanoid').Health ~= 0 then
  45. if input.KeyCode == Enum.KeyCode.Q then
  46. local punch1 = char.Humanoid:LoadAnimation(script.Punch1)
  47. punch1:Play()
  48. debounce = false
  49. candmg = true
  50. wait(.01)
  51. wait(.4)
  52. debounce = true
  53. wait(.1)
  54. candmg = false
  55. end
  56. end
  57. end
  58. end)
  59.  
  60. part.Touched:connect(function(hit)
  61. if hit.Parent:FindFirstChild('Humanoid') then
  62. if candmg == true then
  63. hit.Parent:WaitForChild('Humanoid'):TakeDamage(8)
  64. candmg = false
  65. end
  66. end
  67. end)
Add Comment
Please, Sign In to add comment