RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"and add that you can do max 4 punches before the cooldown starting"
-- roblox script -- local script local player = game:GetService("Players").LocalPlayer local mouse = player:GetMouse() local humanoid = player.Character.Humanoid local animation1 = game:GetService("ReplicatedStorage")["right punch"] local animation2 = game:GetService("ReplicatedStorage")["left punch"] local currentAnimation = animation1 local isAnimating = false local punchCount = 0 local cooldown = false local resetCounterTime = 2 -- time in seconds local maxPunches = 4 -- max punches before cooldown local function resetCounter() punchCount = 0 cooldown = false end local function startResetCounterTimer() local timer = resetCounterTime while timer > 0 and punchCount > 0 do wait(1) timer = timer - 1 end if punchCount > 0 then resetCounter() end end mouse.Button1Down:Connect(function() if not isAnimating and not cooldown then isAnimating = true local anim = humanoid:LoadAnimation(currentAnimation) anim:Play() punchCount = punchCount + 1 if punchCount >= maxPunches then cooldown = true wait(2) resetCounter() else startResetCounterTimer() end while anim.IsPlaying do wait() end if currentAnimation == animation1 then currentAnimation = animation2 else currentAnimation = animation1 end isAnimating = false end end)