Help with a pairs error

While working on this round system script I’ve run into an error invalid argument #1 to ‘ipairs’ (table expected, got instance) but it shouldn’t be able to even grab an instance?

local Script = script.Parent
local timer = 45
local roundInProgress = false
local Players = game:GetService("Players")
local storage = game:GetService("ReplicatedStorage")
local status = storage.RoundStatus
local Monster = require(game.ServerScriptService.MonsterModule)
local Human = require(game.ServerScriptService.HumanModule)
local Teams = game:GetService("Teams")
local SStorage = game:GetService("ServerStorage")
local Queue = workspace.lobby["Monster Queue"].Queue
while true do
	if timer >= 0  and not roundInProgress then
		repeat
			status.Value = timer
			timer -= 1
			task.wait(1)
		until timer < 0
		roundInProgress = true
		local Active = Queue:FindFirstChildWhichIsA("TextLabel").Name
		for _, v in ipairs(game:GetService("Players")) do
			if v.Name == Active then
				print(Active)
			end
		end
		timer = 10
		task.wait(1)
	elseif timer >= 0 and roundInProgress then
		repeat
			status.Value = timer
			timer -= 1
			task.wait(1)
		until timer < 0
			roundInProgress = false
			status.Value = "Fight Ended"
			timer = 45
			task.wait(1)
	end
end

do you mean game:GetService("Players"):GetPlayers()? or another function that returns a table?
the service itself is non-iterable

1 Like

Add a :GetChildren() after getting players service

I knew I overlooked something dumb like that, but yeah thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.