Advertisement
Guest User

punch script ( roblox ) by shebov3

a guest
Jul 1st, 2018
18,597
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. create a script and copy that
  2.  
  3. Punch script
  4. -----------------------------------------------------------------------
  5. --Made by shebov3
  6. math.randomseed(tick())
  7.  
  8. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  9. local punchEvent = Instance.new("RemoteEvent", ReplicatedStorage)
  10. punchEvent.Name = "PunchEvent"
  11.  
  12. local animations = {} put your animation id
  13.  
  14. local function onPunchFired(plr)
  15. local char = game.Workspace:FindFirstChild(plr.Name)
  16. local humanoid = char.Humanoid
  17. local animation = Instance.new("Animation")
  18. local picked = math.random(1, #animations)
  19. animation.AnimationId = "http://roblox.com/asset/?id="..animations[picked]
  20. local animTrack = humanoid:LoadAnimation(animation)
  21. animTrack:Play()
  22. local dmgScript = script.DmgScript:Clone()
  23. if picked == 1 then
  24. dmgScript.Parent = char.RightHand
  25. elseif picked == 2 then
  26. dmgScript.Parent = char.LeftHand
  27. end
  28. dmgScript.Disabled = false
  29. wait(0.4)
  30. dmgScript:Destroy()
  31. end
  32.  
  33. punchEvent.OnServerEvent:Connect(onPunchFired)
  34.  
  35.  
  36. create a script and put it in ServerScriptService
  37.  
  38. ----------------------------------------------------------------------------
  39. create another script
  40. then copy that
  41. -------------------------------------------------------------------------
  42. Dmg script
  43.  
  44. script.Parent.Touched:Connect(function(hit)
  45. local char = hit.Parent
  46. local hum = char:FindFirstChild("Humanoid")
  47. if hum and char.Name ~= script.Parent.Parent.Name then
  48. hum.Health = hum.Health - script.Dmg.Value
  49. script.Disabled = true
  50. wait(0.5)
  51. script.Disabled = false
  52. end
  53. end)
  54.  
  55. ------------------------------------------------------------------
  56. then put it on the first script
  57.  
  58. put on it a stringe value
  59.  
  60.  
  61.  
  62.  
  63. after that all open startercharacterscripts
  64.  
  65. and do a local script
  66. and copy that script
  67. -----------------------------------------
  68. --Made by shebov3
  69. wait (0.1)
  70. local UserInputService = game:GetService("UserInputService")
  71. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  72. local punchEvent = ReplicatedStorage:WaitForChild("PunchEvent")
  73.  
  74. local ready = true
  75.  
  76. local function punch(inputObject, gameProcessed)
  77. if inputObject.KeyCode == Enum.KeyCode.E and ready then
  78. punchEvent:FireServer()
  79. ready = false
  80. wait(0.4)
  81. ready = true
  82. end
  83. end
  84.  
  85. UserInputService.InputBegan:Connect(punch)
  86. ----------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement