REDPlays

JoJo Part 2 Scripts

Jan 20th, 2020
22,876
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.38 KB | None | 0 0
  1. --//Local script for Punching
  2.  
  3. local Player = game:GetService("Players").LocalPlayer
  4.  
  5. local rp = game:GetService("ReplicatedStorage")
  6. local Punch = rp:WaitForChild("Punch")
  7.  
  8. local UIS = game:GetService("UserInputService")
  9.  
  10. local debounce = false
  11. local cooldown = .75
  12.  
  13. UIS.InputBegan:Connect(function(input,IsTyping)
  14. if IsTyping then
  15. return
  16. elseif input.UserInputType == Enum.UserInputType.MouseButton1 then
  17.  
  18. if workspace:FindFirstChild(Player.Name.." Stand") then
  19. if debounce == false then
  20. debounce = true
  21.  
  22. Punch:FireServer()
  23.  
  24. wait(cooldown)
  25. debounce = false
  26. end
  27. end
  28.  
  29. end
  30. end)
  31.  
  32. --//Server Script for Punching
  33.  
  34. local rp = game:GetService("ReplicatedStorage")
  35. local Punch = rp:WaitForChild("Punch")
  36. local Debris = game:GetService("Debris")
  37.  
  38. local damage = 10
  39. local currentAtk = 0
  40.  
  41. Punch.OnServerEvent:Connect(function(Player)
  42. local Character = Player.Character
  43. local Humanoid = Character:WaitForChild("Humanoid")
  44. local HumanoidRP = Character:WaitForChild("HumanoidRootPart")
  45.  
  46. local Stand = workspace:FindFirstChild(Player.Name.." Stand"):WaitForChild("Dummy")
  47.  
  48. local folder = Instance.new("Folder",workspace)
  49. folder.Name = Player.Name.." Stand Punch"
  50. Debris:AddItem(folder,.5)
  51.  
  52. if Stand then
  53. currentAtk = currentAtk + 1
  54. local prevWeld = Stand:WaitForChild("HumanoidRootPart"):WaitForChild("Stand Weld")
  55. prevWeld:Destroy()
  56.  
  57. Stand:WaitForChild("HumanoidRootPart").CFrame = HumanoidRP.CFrame * CFrame.new(0,-.5,-2)
  58.  
  59. local weld = Instance.new("ManualWeld")
  60. weld.Name = "Stand Weld"
  61. weld.Part0 = Stand:WaitForChild("HumanoidRootPart")
  62. weld.Part1 = HumanoidRP
  63. weld.C0 = Stand:WaitForChild("HumanoidRootPart").CFrame:inverse() * HumanoidRP.CFrame
  64. weld.Parent = weld.Part0
  65.  
  66. if currentAtk == 1 then
  67. local Hand = Stand:WaitForChild("LeftHand")
  68. local animControl = Stand:WaitForChild("AnimControl")
  69. local Punch = animControl:LoadAnimation(script:WaitForChild("LeftPunch"))
  70. Punch:Play()
  71.  
  72. local HitBox = script:WaitForChild("HitBox"):Clone()
  73. HitBox.CFrame = Hand.CFrame
  74. HitBox.Parent = folder
  75.  
  76. local Pweld = Instance.new("Weld")
  77. Pweld.Part0 = HitBox
  78. Pweld.Part1 = Hand
  79. Pweld.C0 = HitBox.CFrame:inverse() * Hand.CFrame
  80. Pweld.Parent = Pweld.Part0
  81.  
  82. HitBox.Touched:Connect(function(Hit)
  83. if Hit:IsA("Part") or Hit:IsA("MeshPart") then
  84. if Hit.Parent ~= Character then
  85. local EHumanoid = Hit.Parent:FindFirstChild("Humanoid")
  86.  
  87. if EHumanoid then
  88. HitBox:Destroy()
  89.  
  90. local sound = Instance.new("Sound",folder)
  91. sound.SoundId = "rbxassetid://2174934844"
  92. sound.Volume = 1
  93. sound:Play()
  94. Debris:AddItem(sound,.5)
  95.  
  96. EHumanoid:TakeDamage(damage)
  97. end
  98. end
  99. end
  100. end)
  101.  
  102. wait(.5)
  103. local prevWeld = Stand:WaitForChild("HumanoidRootPart"):WaitForChild("Stand Weld")
  104. prevWeld:Destroy()
  105.  
  106. Stand:WaitForChild("HumanoidRootPart").CFrame = HumanoidRP.CFrame * CFrame.new(2,0,2)
  107.  
  108. local weld = Instance.new("ManualWeld")
  109. weld.Name = "Stand Weld"
  110. weld.Part0 = Stand:WaitForChild("HumanoidRootPart")
  111. weld.Part1 = HumanoidRP
  112. weld.C0 = Stand:WaitForChild("HumanoidRootPart").CFrame:inverse() * HumanoidRP.CFrame
  113. weld.Parent = weld.Part0
  114.  
  115. elseif currentAtk == 2 then
  116. local Hand = Stand:WaitForChild("RightHand")
  117. local animControl = Stand:WaitForChild("AnimControl")
  118. local Punch = animControl:LoadAnimation(script:WaitForChild("RightPunch"))
  119. Punch:Play()
  120.  
  121. local HitBox = script:WaitForChild("HitBox"):Clone()
  122. HitBox.CFrame = Hand.CFrame
  123. HitBox.Parent = folder
  124.  
  125. local Pweld = Instance.new("Weld")
  126. Pweld.Part0 = HitBox
  127. Pweld.Part1 = Hand
  128. Pweld.C0 = HitBox.CFrame:inverse() * Hand.CFrame
  129. Pweld.Parent = Pweld.Part0
  130.  
  131. HitBox.Touched:Connect(function(Hit)
  132. if Hit:IsA("Part") or Hit:IsA("MeshPart") then
  133. if Hit.Parent ~= Character then
  134. local EHumanoid = Hit.Parent:FindFirstChild("Humanoid")
  135.  
  136. if EHumanoid then
  137. HitBox:Destroy()
  138.  
  139. local sound = Instance.new("Sound",folder)
  140. sound.SoundId = "rbxassetid://2174934844"
  141. sound.Volume = 1
  142. sound:Play()
  143. Debris:AddItem(sound,.5)
  144.  
  145. EHumanoid:TakeDamage(damage)
  146. end
  147. end
  148. end
  149. end)
  150.  
  151. wait(.5)
  152. local prevWeld = Stand:WaitForChild("HumanoidRootPart"):WaitForChild("Stand Weld")
  153. prevWeld:Destroy()
  154.  
  155. Stand:WaitForChild("HumanoidRootPart").CFrame = HumanoidRP.CFrame * CFrame.new(2,0,2)
  156.  
  157. local weld = Instance.new("ManualWeld")
  158. weld.Name = "Stand Weld"
  159. weld.Part0 = Stand:WaitForChild("HumanoidRootPart")
  160. weld.Part1 = HumanoidRP
  161. weld.C0 = Stand:WaitForChild("HumanoidRootPart").CFrame:inverse() * HumanoidRP.CFrame
  162. weld.Parent = weld.Part0
  163.  
  164. else
  165. currentAtk = 1
  166. local Hand = Stand:WaitForChild("LeftHand")
  167. local animControl = Stand:WaitForChild("AnimControl")
  168. local Punch = animControl:LoadAnimation(script:WaitForChild("LeftPunch"))
  169. Punch:Play()
  170.  
  171. local HitBox = script:WaitForChild("HitBox"):Clone()
  172. HitBox.CFrame = Hand.CFrame
  173. HitBox.Parent = folder
  174.  
  175. local Pweld = Instance.new("Weld")
  176. Pweld.Part0 = HitBox
  177. Pweld.Part1 = Hand
  178. Pweld.C0 = HitBox.CFrame:inverse() * Hand.CFrame
  179. Pweld.Parent = Pweld.Part0
  180.  
  181. HitBox.Touched:Connect(function(Hit)
  182. if Hit:IsA("Part") or Hit:IsA("MeshPart") then
  183. if Hit.Parent ~= Character then
  184. local EHumanoid = Hit.Parent:FindFirstChild("Humanoid")
  185.  
  186. if EHumanoid then
  187. HitBox:Destroy()
  188.  
  189. local sound = Instance.new("Sound",folder)
  190. sound.SoundId = "rbxassetid://2174934844"
  191. sound.Volume = 1
  192. sound:Play()
  193. Debris:AddItem(sound,.5)
  194.  
  195. EHumanoid:TakeDamage(damage)
  196. end
  197. end
  198. end
  199. end)
  200.  
  201. wait(.5)
  202. local prevWeld = Stand:WaitForChild("HumanoidRootPart"):WaitForChild("Stand Weld")
  203. prevWeld:Destroy()
  204.  
  205. Stand:WaitForChild("HumanoidRootPart").CFrame = HumanoidRP.CFrame * CFrame.new(2,0,2)
  206.  
  207. local weld = Instance.new("ManualWeld")
  208. weld.Name = "Stand Weld"
  209. weld.Part0 = Stand:WaitForChild("HumanoidRootPart")
  210. weld.Part1 = HumanoidRP
  211. weld.C0 = Stand:WaitForChild("HumanoidRootPart").CFrame:inverse() * HumanoidRP.CFrame
  212. weld.Parent = weld.Part0
  213.  
  214. end
  215.  
  216. end
  217.  
  218. end)
Advertisement
Add Comment
Please, Sign In to add comment