Attempt to get the length of an instance value error

Hey there, so I have a rather odd error that should not be happening in the current context.

The error is: Attempt to get length of an instance value

This is my code:

RunService.Heartbeat:Connect(function()
	for i, v in pairs(Queue:GetChildren()) do
		if #v == 2 then
			for i, s in pairs(Spawns:GetChildren()) do
				s.Name = v.Name
				
				local player = workspace:FindFirstChild(v.Name)
				
				local pObj = game.Players:GetPlayerFromCharacter(player)
				
				if player then
					if Spawns:FindFirstChild(player.Name) then
						player.PrimaryPart.CFrame = Spawns:FindFirstChild(player.Name).CFrame
						player.Humanoid.WalkSpeed = 0
						pObj.InQueue.Value = false
					else
						warn("No spawn named: ".. player.Name)
					end
				else
					warn("No player detected with the name of: ".. player.Name)
				end
				
				for x = 5,1,-1 do
					Countdown.Value = i
					wait(1)
				end
				
				player.Humanoid.WalkSpeed = 16
				
				pObj.InQueue.Value = false
				
				Queue:FindFirstChild(player.Name:Destroy())
			end
		else
			warn("Not equal to 2")
		end
	end
end)

If you know what is going on, please don’t hesitate to tell me! Thanks!

What are you trying to do with if #v == 2 then and what did you except the variable v to be? v is an Instance and you cannot get the length of an instance value.

Well, lets start with this:

Queue is a folder in ReplicatedStorage, and v should be the GetChildren() callback.

I am trying to get the amount of children in the Queue folder

Odd, you should use #Queue:GetChildren() instead. v is just the value to the i, which index of the table used after in.

Thank you, this seems to work!