How to make a queue/buffer system for a table

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    making a item randomizer that is kinda like black magic 2 or souls combat
  2. What is the issue? Include screenshots / videos if possible!
    I wanted to delay the animations that is being played of a table but i don’t really know how
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    i tried the buffer/queue for the input but i dont really know how to make it into a table
    Queue/Buffering System - Help and Feedback / Scripting Support - DevForum | Roblox
    The system in question:
local queue = {}

function add_attack_to_queue(Anim)
	table.insert(queue,Anim)
	
end

function get_next_attack()
	return table.remove(queue,2)
end
	

the table and the script that does the animation:

	local tableAnim = {

		script.Slash1,
		script.Slash2,
		script.Slash3
		
		
	}

	

	for i,v in pairs(tableAnim) do
		
		print (i,v)
		

end
	
	if anyCombo then
		
		local Anim = tableAnim[combo]
		local playAnim = Char.Humanoid:LoadAnimation(Anim)
	playAnim:Play()
		IsNotPlaying = true
		
	
	combo += 1
	end
	
	
	 

	
	if combo == maxCombo then
		
		combo = firstCombo
		
		
		
			
		end
end

Any help would be appreciated!

also i am using an item