local result, policyInfo = pcall(function()
PolicyService:GetPolicyInfoForPlayerAsync(player)
end)
if not result then
error("PolicyService error: " .. policyInfo)
elseif not table.find(result["AllowedExternalLinkReferences"], "Discord") then
small code snippet, yes player is defined. I am assuming this error has to do with the string.find: ServerScriptService.UserInfo:18: attempt to index boolean with 'AllowedExternalLinkReferences
What’s the fix? Please, if you have time, explain it to me because I need to expand my knowledge on defining tables and all that.
result is a boolean. But you are trying to index it at
Revised code:
local ok, data = pcall(PolicyService.GetPolicyInfoForPlayerAsync, PolicyService, player)
if ok then
if not table.find(data.AllowedExternalLinkReferences, "Discord") then
-- something
end
else
warn(data)
end