How can I check the values on a table to see if they match any values on another table

I have a table for all the players that have finished (FinishedPlayers) and a table for all the players in the server (Plrs). I want the event to fire for every player that didn’t finish. What am I doing wrong here.

for _, Plr in next, Plrs do
		if type(Plr) ~= FinishedPlayers then 
			EliminatedTextEvent:FireClient(Plr)
		end
		wait()
	end

You can maybe use table.find() (more info here tables) and check if it return nil, if it does then fire the event for that player

1 Like

Yes, that’d be one way to go about it.

local function getArrayDifference(t1, t2)
	local t3 = {}
	for _, value in ipairs(t1) do
		if not table.find(t2, value) then
			table.insert(t3, value)
		end
	end
	return t3
end

Just make sure the first argument is the larger of the two arrays (longer).