Advertisement
Guest User

Untitled

a guest
May 28th, 2023
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.46 KB | None | 0 0
  1.  
  2.  
  3. game:GetService("UserInputService").InputBegan:Connect(function(input)
  4. if input.UserInputType == Enum.UserInputType.MouseButton1 and CurrentStaminaAmount >80 and Crouching==false and Tumbling==false then -- Arm Fireball
  5. if armCanFire and armCurrentCharges > 0 and not armPunchAnimationPlaying then
  6. armCanFire = false
  7. armCurrentCharges -= 1
  8.  
  9. FireballStamina:Fire(fireballpunch)
  10.  
  11. local character = player.Character
  12. local humanoid = Humanoid
  13. if humanoid then
  14. armPunchAnimationPlaying = true
  15. local punchAnimation
  16. local handPart
  17. if currentArmHand == "Right" then
  18. punchAnimation = humanoid:LoadAnimation(rightPunchAnimation)
  19. handPart = character:WaitForChild("RightHand")
  20. currentArmHand = "Left"
  21. else
  22. punchAnimation = humanoid:LoadAnimation(leftPunchAnimation)
  23. handPart = character:WaitForChild("LeftHand")
  24. currentArmHand = "Right"
  25. end
  26. punchAnimation:Play()
  27.  
  28. punchAnimation.Stopped:Wait()
  29. armPunchAnimationPlaying = false
  30. armCanFire = true
  31.  
  32. local fireball = fireballModel:Clone()
  33. fireball.Parent = flameFolder
  34.  
  35. local directionUnitVector = (mouse.Hit.p - handPart.Position).Unit
  36.  
  37. fireball.CFrame = CFrame.new(handPart.Position, handPart.Position + directionUnitVector * fireballDistance)*fireballangle
  38.  
  39. -- Damage handling
  40. local damageAmount = 25
  41. local hasHit = false
  42.  
  43.  
  44. fireball.Touched:Connect(function(part)
  45. if not hasHit then
  46. local humanoid = part.Parent:FindFirstChild("Humanoid")
  47. if humanoid and humanoid.Parent.Name ~= player.Name then
  48. humanoid:TakeDamage(damageAmount)
  49. hasHit = true
  50. if FireCurrentCharge<FireMaxCharge and not (FireCurrentCharge>=FireMaxCharge) then
  51. OnHitCharge()
  52. end
  53. fireball.Parent=nil
  54. if FireCurrentCharge>0 then
  55. OnHitChargeDecay()
  56. end
  57. end
  58. end
  59. end)
  60.  
  61.  
  62. spawn(function()
  63. local startTime = tick()
  64. while tick() - startTime < fireballDistance / fireballSpeed do
  65. fireball.Position += directionUnitVector * fireballSpeed * (tick() - startTime)
  66. wait()
  67. end
  68. fireball.Parent=nil
  69. end)
  70.  
  71.  
  72. local function checkCollisions()
  73. while fireball.Parent do
  74. wait() -- Add a small delay to avoid excessive looping
  75.  
  76. local touchingParts = fireball:GetTouchingParts()
  77. local collidedWithWorld = false
  78.  
  79. for _, part in ipairs(touchingParts) do
  80. if part:IsDescendantOf(worldFolder) then
  81. collidedWithWorld = true
  82. break
  83. end
  84. end
  85.  
  86. if collidedWithWorld then
  87. fireball.Parent = nil
  88. end
  89. end
  90.  
  91. end
  92.  
  93. spawn(checkCollisions)
  94.  
  95. end
  96. end
  97. elseif input.UserInputType == Enum.UserInputType.MouseButton2 and CurrentStaminaAmount >100 and Crouching==false and Tumbling==false then -- Leg Fireball
  98. if legCanFire and legCurrentCharges > 0 and not legPunchAnimationPlaying then
  99. Kicked()
  100. legCanFire = false
  101. legCurrentCharges -= 1
  102. FireballStamina:Fire(fireballkick)
  103.  
  104.  
  105. local character = player.Character
  106. local humanoid = character and character:FindFirstChildOfClass("Humanoid")
  107. if humanoid then
  108. legPunchAnimationPlaying = true
  109. local punchAnimation
  110. local legPart
  111. if currentLegHand == "Right" then
  112. currentLegHand = "Left"
  113. punchAnimation = humanoid:LoadAnimation(rightKickAnimation)
  114. legPart = character:WaitForChild("RightFoot")
  115. else
  116. currentLegHand = "Right"
  117. punchAnimation = humanoid:LoadAnimation(leftKickAnimation)
  118. legPart = character:WaitForChild("LeftFoot")
  119. end
  120.  
  121. punchAnimation:Play()
  122.  
  123. -- Rest of the code...
  124.  
  125. punchAnimation:Play()
  126.  
  127. punchAnimation.Stopped:Wait()
  128. legPunchAnimationPlaying = false
  129. legCanFire = true
  130.  
  131. local fireball = fireballModel:Clone()
  132. fireball.Parent = flameFolder
  133.  
  134. local directionUnitVector = (mouse.Hit.p - legPart.Position).Unit
  135.  
  136. fireball.CFrame = CFrame.new(legPart.Position, legPart.Position + directionUnitVector * fireballDistance)*fireballangle
  137.  
  138. -- Damage handling
  139. local damageAmount = 50
  140. local hasHit = false
  141.  
  142. fireball.Touched:Connect(function(part)
  143. if not hasHit then
  144. local humanoid = part.Parent:FindFirstChild("Humanoid")
  145. if humanoid and humanoid.Parent.Name ~= player.Name then
  146. humanoid:TakeDamage(damageAmount)
  147. hasHit = true
  148. if FireCurrentCharge<FireMaxCharge and not (FireCurrentCharge>=FireMaxCharge) then
  149. OnHitCharge()
  150. end
  151. fireball.Parent=nil
  152. if FireCurrentCharge>0 then
  153. OnHitChargeDecay()
  154. end
  155. end
  156. end
  157. end)
  158.  
  159. spawn(function()
  160. local startTime = tick()
  161. while tick() - startTime < fireballDistance / fireballSpeed do
  162. fireball.Position += directionUnitVector * fireballSpeed * (tick() - startTime)
  163. wait()
  164. end
  165. fireball.Parent=nil
  166. end)
  167.  
  168. local function checkCollisions()
  169. while fireball.Parent do
  170. wait() -- Add a small delay to avoid excessive looping
  171.  
  172. local touchingParts = fireball:GetTouchingParts()
  173. local collidedWithWorld = false
  174.  
  175. for _, part in ipairs(touchingParts) do
  176. if part:IsDescendantOf(worldFolder) then
  177. collidedWithWorld = true
  178. break
  179. end
  180. end
  181.  
  182. if collidedWithWorld then
  183. fireball.Parent = nil
  184. end
  185. end
  186.  
  187. end
  188.  
  189. spawn(checkCollisions)
  190.  
  191. end
  192. end
  193. end
  194. end)
  195.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement