So I dont want a whole code(If you do, thanks) but how would i make it possible to only spectate players in a table?

Here is my table code (In normal script) ((Spectate Gui is normaly in a seperate local script, isnt it? How would I do that? Because i cant acces the table from my normal script on the localscript, can I?))

activecontestants = {}
	
	for _, player in pairs(contestants) do
			if player then
				local character = player.Character
				if character then
					local humanoid = character:FindFirstChild("Humanoid")
					if humanoid and humanoid.Health > 0 then
						if player ~= Gamemaker then
						table.insert(activecontestants, player)
					end
				end
			end
		end
	end

So how would I get to only spectate the players who are in this table? I looked up the internet and there is no good tutorial for this to do it right. They all just get all players in game.

I tried many ways and still fail. I tried to put a string in the players who are in the Table and search for the string, but i failed.

Please, please help meeh, my brain starts to hurt..

4 comments

0

Any errors?

0

On this particular part of the code, no.

0

I assume contestants is the table the function Players:GetPlayers returns

0

yes. and then they will be put in the table activecontestants.