So i created a combo script, It works great, one issue. Whenever i attack, the combo picks up on the next animation that i left off at. I need it to reset after not clicking for 1 second
local punchcd = false
local punchcombo = 1
function punch()
if activu == true then return end
if punchcd == true then return end
activu = true
human.JumpPower = 0
if punchcombo == 1 then
punchcombo = 2
anim3:Play(0.1, 1, 1.5)
wait(0.15)
coroutine.resume(coroutine.create(function()
for _ = 1, 5 do
wait()
damage(rightarm, rightarm.CFrame * CFrame.new(0, -1, 0) * CFrame.new(math.random(-0.25, 0.25), math.random(-0.25, 0.25), math.random(-0.25, 0.25)) ,5.4, 5, 0.5, 0.25, hrp.CFrame.lookVector * 10,"rbxassetid://743886825",1)
end
end))
elseif punchcombo == 2 then
punchcombo = 3
anim1:Play(0.1, 1, 1.5)
wait(0.15)
coroutine.resume(coroutine.create(function()
for _ = 1, 5 do
wait()
damage(leftarm, leftarm.CFrame * CFrame.new(0, -1, 0) * CFrame.new(math.random(-0.25, 0.25), math.random(-0.25, 0.25), math.random(-0.25, 0.25)) ,5.4, 5, 0.5, 0.25, hrp.CFrame.lookVector * 10,"rbxassetid://743886825",1)
end
end))
elseif punchcombo == 3 then
punchcombo = 4
anim3:Play(0.1, 1, 1.5)
wait(0.15)
coroutine.resume(coroutine.create(function()
for _ = 1, 5 do
wait()
damage(rightarm, rightarm.CFrame * CFrame.new(0, -1, 0) * CFrame.new(math.random(-0.25, 0.25), math.random(-0.25, 0.25), math.random(-0.25, 0.25)) ,5.4, 5, 0.5, 0.25, hrp.CFrame.lookVector * 10,"rbxassetid://743886825",1)
end
end))
elseif punchcombo == 4 then
punchcombo = 5
anim4:Play(0.1, 1, 1.5)
wait(0.15)
coroutine.resume(coroutine.create(function()
for _ = 1, 5 do
wait()
damage(leftarm, leftarm.CFrame * CFrame.new(0, -1, 0) * CFrame.new(math.random(-0.25, 0.25), math.random(-0.25, 0.25), math.random(-0.25, 0.25)) ,5.4, 5, 0.5, 0.25, hrp.CFrame.lookVector * 10,"rbxassetid://743886825",1)
end
end))
elseif punchcombo == 5 then
punchcombo = 1
anim5:Play(0.1, 1, 1.5)
wait(0.2)
coroutine.resume(coroutine.create(function()
for _ = 1, 5 do
wait()
damage(rightleg, rightleg.CFrame * CFrame.new(0, -1, 0) * CFrame.new(math.random(-0.25, 0.25), math.random(-0.25, 0.25), math.random(-0.25, 0.25)) ,6, 6, 0.5, 0.25, hrp.CFrame.lookVector * 40,"rbxassetid://743886825",.7)
end
end))
punchcd = true
wait(1.1)
punchcd = false
end
wait(0.255)
activu = false
human.JumpPower = 50
end
I’ve been brainstorming but i can’t really think of a good way to do this