Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

attempt to index function with 'name' ?

Asked by 3 years ago
for key, value in pairs(GList) do
if PlrN:IsInGroup(value['name']) then   -- (error here)

print("player is in one of the listed groups")

end

1 answer

Log in to vote
0
Answered by 3 years ago

Your syntax is a bit off...

You're trying to index the value with a string.

You should be trying to index the table with the key(index)

Like so...

for index, value in pairs(GList) do
    if PlrN:IsInGroup(GList[index]) then
        print(PlrN.Name.." Is In "..value) --// Will print something like this "killerbrenden Is In A Group"
    end
end

Hope this helped! Feel free to select this as an answer if this helped you!

Ad

Answer this question