How To Check If Something Isn't On An Array

So, I want to check if someone isn’t on an array using for i,v in pairs() but I don’t know how because If I try to do it, it will just keep looping.

local people = {1,2,3,4,5}

for _,v in pairs(people) do
    if v == 5 then
          print(":O")
else
           print("???")
    end
end

The thing is, it keeps running until it reaches 5…

(Note: I Can’t Use Table.Find Since I’m Using Trello For Bans Unless There’s Another Way?)

Basically, i’m making a Trello Ban System but I want it to print No if they’re not on the ban list. But, it just keep repeating…

Sorry if it’s not clear.

Couldn’t you try if not v == "aha" then…?

1 Like

Yes, yes I could actually. Thanks!

Edit: But I’d Use if v == "aha" then

Edit 2: It actually won’t solve it since I just thought about it. Why you may ask, because it’s still looping through.

1 Like

Why can’t you use it because of that?

(Also Trello is not designed for storing data)

So you can write this as a function to make it very compact and useful

local function CheckObjTable(Table, Obj)
	for _,v in ipairs(Table) do
		if v == Obj then
			return true;
		end
	end
	return false;
end

print(CheckObjTable(Table, Obj) and "Exists in table" or "Does not exist in table");
1 Like

Just use DataStores instead of Trello list as they are better and Hackers or exploiters can’t do anything to them at all

The thing is, I can’t use DataStores for this since i’m doing something else. Another thing is that Exploiters can’t edit the Trello Board either.