So I’m making a GUI that gets all the allies and enemies of a group. I made a function in a module script that does this automatically for me without me doing too much work.
[Players.ThatLuaDev.PlayerGui.Menu.Master:17: attempt to call a table value]
^ Is the error I am getting when calling this function:
function Utility:GetAffiliatesAsync(GroupId)
local GroupServ = game:GetService("GroupService")
local Affiliates = {Allies = {}, Enemies = {}}
local AlliesPages, EnemiesPages = GroupServ:GetAlliesAsync(GroupId), GroupServ:GetEnemiesAsync(GroupId)
while wait() do
for _,Ally in pairs(AlliesPages:GetCurrentPage()) do
table.insert(Affiliates.Allies, Ally)
print("Inserted ally")
end
if AlliesPages.isFinished then
break
end
AlliesPages:AdvanceToNextPageAsync()
end
while wait() do
for _,Enemy in pairs(EnemiesPages:GetCurrentPage()) do
table.insert(Affiliates.Enemies, Enemy)
print("Inserted enemy")
end
if EnemiesPages.isFinished then
break
end
EnemiesPages:AdvanceToNextPageAsync()
end
return Affiliates
end
This is the code on line 17:
local Affiliates = UtilityModule:GetAffiliatesAsync(2569359)
Could anyone help identify my issue?