Continuing after returning false

Are you trying to make specific props spawnable only by specific usergroups, or are you trying to disable prop spawning for everyone except specific usergroups?

Ok I misunderstood, why do you even use groupss?
You’re iterating through the already existing table, then going to the database to get it again… just to use [k] on it? You could just use v

no

next(), given a key in a table, returns the next key and value after it (or nil, if it was the last key). these two loops have basically the same effect:
[lua]
local t = {“apple”, “banana”, “cherry”}

– automatic method, using pairs()
for k, v in pairs(t) do
print(k, v)
end

– manual method, using next()
local k, v = next(t) – only passing the table returns the FIRST key and value
while k ~= nil do
print(k, v)
– we pass the ‘current’ key to next(), and it gives us the NEXT key and value.
– if ‘k’ is currently the LAST key in the table, next() will return nil.
k, v = next(t, k)
end
[/lua]
but just forget about next() for now, you don’t need to use it as a beginner.

and like i said in the last thread, sql.Query returns the entire set of results. you dont need to call sql.QueryValue() to get the ‘current row’ or something, you dont need to call sql.Query() twice. this is all you need to do to iterate over your query results:
[lua]
local res = sql.Query(“SELECT * FROM groups”)
for _, row in pairs(res) do
– assuming groupname is the name of your sql column:
if ply:IsUserGroup(row[“groupname”]) then
return true
end
end
– at this point, we’re done looking through the groups and we didn’t find him,
– so we can return false to prevent him from spawning props.
return false
[/lua]

OP, before you do anything else, please read the official Lua tutorial thoroughly and make sure you actually understand the language.

I think a large part of his problem is not understanding table key->value structure.

Thanks helped a lot, I can see where I was going wrong.