So I’m using pcall function which returns tuple arguments:
function CheckUser(Name)
local success, returned = pcall(function()
return plrs:GetUserIdFromNameAsync(Name)
end)
return success,returned
end
How would I insert the arguments into a table?
for i = 1,3 do
table.insert(NPCIds, {Success = CheckUser(NPCs["npc"..i].TextBox.Text), Result = CheckUser(NPCs["vibenpc"..i].TextBox.Text) } )
print(Vibeids[1].Success) -- only print the first argument, which is success
end
My expected result will be:
print(NPCs[1].Success) -- true (success)
print(NPCs[1].Result) -- 5027420 (returned)
print(NPCs[2].Success) -- false(success)
print(NPCs[2].Result) -- because this user doesn't exist (returned)