Can I make this more efficient?

I feel like the way Im doing this is really inefficient and wanna know if theres another way to update the number instead of using elseifs

local function DefaultCombo()
	if Combo == 1 then
		UpdateCombo()
		knockback()
		print("Stage 2")
	elseif Combo == 2 then
		UpdateCombo()
		knockback()
		print("Stage 3")
	elseif Combo == 3 then
		UpdateCombo()
		knockback()
		print("Stage 4")
	elseif Combo == 4 then
		UpdateCombo()
		knockback()
		print("Stage 5")
	elseif Combo == 5 then
		print("Stage 6")
		knockback()
	end
end
local function DefaultCombo()
    if Combo < 5 then
        UpdateCombo()
    end

	print("Stage", Combo + 1)
    knockback()
end

You’re welcome.

3 Likes
local function DefaultCombo()
	if Combo ~= 5 then
		UpdateCombo()
    end
    knockback()
	print(string.format("Stage %d", Combo))
end
1 Like

Here:

local function DefaultCombo()
    if combo < 5 then
        UpdateCombo()
        knockback()
        print("Stage " .. Combo + 1)
    elseif combo == 5 then
        UpdateCombo()
        knockback()
        print("Stage 5")
    end
end