Table won't loop through 1 by 1

I am trying to create a combat script. While doing so I encountered a problem. Everytime player clicks, the table won’t loop through the combos 1 by 1. Instead it will loop it all as soon as I click once.

So basiclly I would type this:
mouse.Button1Down:connect(function()
for i,v in ipairs(combos) do
print(v.Name)
end
–Output
combo1
combo2
combo3
Isn’t it supposed to say each combo name each time I click???
Here is the full script:
–Created by RinxfulROBLOX, Animations, Combo will run on here, the rest will take place in the serverscript

local meele = script.Parent

local ReplicatedStorage = game.ReplicatedStorage

local meeleEvent = ReplicatedStorage:WaitForChild(“MeeleEvent”)

local equipped = false

local canClick = true

local player = game.Players.LocalPlayer

local character = player.Character

if not character or not character.Parent then

character = player.CharacterAdded:wait() --Checking if character is stil there, do not put this as “local character” it will index as nil

end

local humanoid = character:WaitForChild(“Humanoid”)

local mouse = player:GetMouse()

local combo1 = Instance.new(“Animation”)

combo1.AnimationId = “rbxassetid://6241547671”

combo1.Name = “Combo1”

local combo2 = Instance.new(“Animation”)

combo2.AnimationId = “rbxassetid://6241552356”

combo2.Name = “Combo2”

local combo3 = Instance.new(“Animation”)

combo3.AnimationId = “rbxassetid://6241585092”

combo3.Name = “Combo3”

local combo1Track = humanoid:LoadAnimation(combo1) --Loading before I loop through the animations

local combo2Track = humanoid:LoadAnimation(combo2)

local combo3Track = humanoid:LoadAnimation(combo3)

local combos = {combo1Track, combo2Track, combo3Track} --I put it in a table because when clicked, I am going to loop through these using for i,v in ipairs

local clicks = 0

meele.Equipped:connect(function()

equipped = true

print(“Meele Equipped”) --When Equipped = true, then clicking will be able to happen

end)

meele.Unequipped:connect(function()

equipped = false

print(“Meele unequipped”) --When Equipped = false, then clicking won’t be able to happen

end)

mouse.Button1Down:connect(function()

if equipped == true and canClick == true then --Checking if meele is equipped and canClick == true then

for i,v in pairs(combos) do
print(v.Name)
end

else

print("Meele Not equipped")

equipped = false

end

end)

First can you put all your code inside of a code snippet

Sorry but how do I do that? These are extra words because I need characters for reply

put “```” before your code

local variable = true

” [quote="firsttobebear, post:4, topic:983453, full:true"] put "" before your code

local variable = true
[/quote]

local meele = script.Parent

local ReplicatedStorage = game.ReplicatedStorage

local meeleEvent = ReplicatedStorage:WaitForChild("MeeleEvent")

local equipped = false

local canClick = true

local player = game.Players.LocalPlayer

local character = player.Character

if not character or not character.Parent then

character = player.CharacterAdded:wait() --Checking if character is stil there, do not put this as "local character" it will index as nil

end

local humanoid = character:WaitForChild("Humanoid")

local mouse = player:GetMouse()

local combo1 = Instance.new("Animation")

combo1.AnimationId = "rbxassetid://6241547671"

combo1.Name = "Combo1"

local combo2 = Instance.new("Animation")

combo2.AnimationId = "rbxassetid://6241552356"

combo2.Name = "Combo2"

local combo3 = Instance.new("Animation")

combo3.AnimationId = "rbxassetid://6241585092"

combo3.Name = "Combo3"

local combo1Track = humanoid:LoadAnimation(combo1) --Loading before I loop through the animations

local combo2Track = humanoid:LoadAnimation(combo2)

local combo3Track = humanoid:LoadAnimation(combo3)

local combos = {combo1Track, combo2Track, combo3Track} --I put it in a table because when clicked, I am going to loop through these using for i,v in ipairs

local clicks = 0

meele.Equipped:connect(function()

equipped = true

print("Meele Equipped") --When Equipped = true, then clicking will be able to happen

end)

meele.Unequipped:connect(function()

equipped = false

print("Meele unequipped") --When Equipped = false, then clicking won't be able to happen

end)

mouse.Button1Down:connect(function()

if equipped == true and canClick then

for i = 1, #combos do

clicks = clicks + 1

local currentCombo = combos[i]

print(currentCombo)

canClick = false

table.remove(combos, i)

wait(0.5)

canClick = true

table.insert(combos,

end

end

end)

This?

i am confused what you are trying to do. Do you want it to play each animation when you click?

Yes. Each time I click, want each animation to play. So if I click once, combo 1 plays, then I click again, combo 2 plays,then I click another time, combo 3 plays. Then I reset it.

mouse.Button1Down:connect(function()
	if equipped then
		clicks += 1
		
		if canClick then
			canClick = false
			for i = 1, #combos do
				combos[i]:Play()
				
				if clicks <= i then
					--Break the loop if you don't keep clicking
					break
				end
			end
			
			canClick = true
			clicks = 0 --Reset combo number once you are finished with your current attacks
		end
	end
end)