Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- game:GetService("UserInputService").InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 and CurrentStaminaAmount >80 and Crouching==false and Tumbling==false then -- Arm Fireball
- if armCanFire and armCurrentCharges > 0 and not armPunchAnimationPlaying then
- armCanFire = false
- armCurrentCharges -= 1
- FireballStamina:Fire(fireballpunch)
- local character = player.Character
- local humanoid = Humanoid
- if humanoid then
- armPunchAnimationPlaying = true
- local punchAnimation
- local handPart
- if currentArmHand == "Right" then
- punchAnimation = humanoid:LoadAnimation(rightPunchAnimation)
- handPart = character:WaitForChild("RightHand")
- currentArmHand = "Left"
- else
- punchAnimation = humanoid:LoadAnimation(leftPunchAnimation)
- handPart = character:WaitForChild("LeftHand")
- currentArmHand = "Right"
- end
- punchAnimation:Play()
- punchAnimation.Stopped:Wait()
- armPunchAnimationPlaying = false
- armCanFire = true
- local fireball = fireballModel:Clone()
- fireball.Parent = flameFolder
- local directionUnitVector = (mouse.Hit.p - handPart.Position).Unit
- fireball.CFrame = CFrame.new(handPart.Position, handPart.Position + directionUnitVector * fireballDistance)*fireballangle
- -- Damage handling
- local damageAmount = 25
- local hasHit = false
- fireball.Touched:Connect(function(part)
- if not hasHit then
- local humanoid = part.Parent:FindFirstChild("Humanoid")
- if humanoid and humanoid.Parent.Name ~= player.Name then
- humanoid:TakeDamage(damageAmount)
- hasHit = true
- if FireCurrentCharge<FireMaxCharge and not (FireCurrentCharge>=FireMaxCharge) then
- OnHitCharge()
- end
- fireball.Parent=nil
- if FireCurrentCharge>0 then
- OnHitChargeDecay()
- end
- end
- end
- end)
- spawn(function()
- local startTime = tick()
- while tick() - startTime < fireballDistance / fireballSpeed do
- fireball.Position += directionUnitVector * fireballSpeed * (tick() - startTime)
- wait()
- end
- fireball.Parent=nil
- end)
- local function checkCollisions()
- while fireball.Parent do
- wait() -- Add a small delay to avoid excessive looping
- local touchingParts = fireball:GetTouchingParts()
- local collidedWithWorld = false
- for _, part in ipairs(touchingParts) do
- if part:IsDescendantOf(worldFolder) then
- collidedWithWorld = true
- break
- end
- end
- if collidedWithWorld then
- fireball.Parent = nil
- end
- end
- end
- spawn(checkCollisions)
- end
- end
- elseif input.UserInputType == Enum.UserInputType.MouseButton2 and CurrentStaminaAmount >100 and Crouching==false and Tumbling==false then -- Leg Fireball
- if legCanFire and legCurrentCharges > 0 and not legPunchAnimationPlaying then
- Kicked()
- legCanFire = false
- legCurrentCharges -= 1
- FireballStamina:Fire(fireballkick)
- local character = player.Character
- local humanoid = character and character:FindFirstChildOfClass("Humanoid")
- if humanoid then
- legPunchAnimationPlaying = true
- local punchAnimation
- local legPart
- if currentLegHand == "Right" then
- currentLegHand = "Left"
- punchAnimation = humanoid:LoadAnimation(rightKickAnimation)
- legPart = character:WaitForChild("RightFoot")
- else
- currentLegHand = "Right"
- punchAnimation = humanoid:LoadAnimation(leftKickAnimation)
- legPart = character:WaitForChild("LeftFoot")
- end
- punchAnimation:Play()
- -- Rest of the code...
- punchAnimation:Play()
- punchAnimation.Stopped:Wait()
- legPunchAnimationPlaying = false
- legCanFire = true
- local fireball = fireballModel:Clone()
- fireball.Parent = flameFolder
- local directionUnitVector = (mouse.Hit.p - legPart.Position).Unit
- fireball.CFrame = CFrame.new(legPart.Position, legPart.Position + directionUnitVector * fireballDistance)*fireballangle
- -- Damage handling
- local damageAmount = 50
- local hasHit = false
- fireball.Touched:Connect(function(part)
- if not hasHit then
- local humanoid = part.Parent:FindFirstChild("Humanoid")
- if humanoid and humanoid.Parent.Name ~= player.Name then
- humanoid:TakeDamage(damageAmount)
- hasHit = true
- if FireCurrentCharge<FireMaxCharge and not (FireCurrentCharge>=FireMaxCharge) then
- OnHitCharge()
- end
- fireball.Parent=nil
- if FireCurrentCharge>0 then
- OnHitChargeDecay()
- end
- end
- end
- end)
- spawn(function()
- local startTime = tick()
- while tick() - startTime < fireballDistance / fireballSpeed do
- fireball.Position += directionUnitVector * fireballSpeed * (tick() - startTime)
- wait()
- end
- fireball.Parent=nil
- end)
- local function checkCollisions()
- while fireball.Parent do
- wait() -- Add a small delay to avoid excessive looping
- local touchingParts = fireball:GetTouchingParts()
- local collidedWithWorld = false
- for _, part in ipairs(touchingParts) do
- if part:IsDescendantOf(worldFolder) then
- collidedWithWorld = true
- break
- end
- end
- if collidedWithWorld then
- fireball.Parent = nil
- end
- end
- end
- spawn(checkCollisions)
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement