ive been trying to figure this out but I cant figure it out how would I make it so the combo resets after a certain amount of time


Enabled = true
local combo = 1
damage = 37
script.Parent.OnServerEvent:Connect(function(player,action,var)
    damage = 37 + player.SkillsFolder.Strength.Value
    if Enabled == false then return end
    local chr = player.Character
    
    if action =="Attack" then
        Enabled = false
        
        
        if combo == 1 then
        local anim = script.Slash1
        local playanimation = chr.Humanoid:LoadAnimation(anim)
            playanimation:Play()
            combo = 2
            else
            local anim = script.Slash2
            local playanimation = chr.Humanoid:LoadAnimation(anim)
            playanimation:Play()
            combo = 1
        end
        for i,v in pairs(workspace:GetChildren()) do
            if v:FindFirstChild("HumanoidRootPart") and v:FindFirstChild("Humanoid") then
                if v~= chr then
                    if (v.HumanoidRootPart.Position - chr.HumanoidRootPart.Position).magnitude < 7 then
                        v.Humanoid:TakeDamage(damage)
                    end
                end
            end
        end
        wait(0.8)
        Enabled = true
    end
end)

1 comment

0

You can add a countdown timer that counts down the time and if it reaches 0 then the combo stops.