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

How do I fix this error I got from my code and module code?

Asked by 3 years ago

I was trying to store the player's info and trying to get it to print it. Attempting to print it produced an error.

--The Server Code
    local function getPlayerInfo()

        local AvatarInfo = Players:GetHumanoidDescriptionFromUserId(plr.UserId)
        local PolicyInfo =PolicyService:GetPolicyInfoForPlayerAsync(plr)

        local Info = {

            Name = plr.Name,

            UserId = plr.UserId,

            Avatar = AvatarInfo,

            PolicyInfo = PolicyInfo,

            Region = LocalizationService:GetCountryRegionForPlayerAsync(plr),

            Data = {

                GroupData = GroupData,

                LevelData = LevelData,

                BanData = BanData
            }
        }

        return Info
    end

    local playerInfo = getPlayerInfo()

    PlayerInfo.Register(plr.Name, playerInfo)
        print(PlayerInfo.Get(plr.Name).Name)--The error 
--The module's code
local PlayerInfo = {}

return {
    Register = function(key, value)
        PlayerInfo[key] = value
        print("[PlayerInfo]: "..key.." has been registered")
    end,

    Request = function(key)

        return PlayerInfo[key]
    end

}

0
Can you supply the error message? You're likely trying to access a function or value that doesn't exist in `PlayerInfo` climethestair 1663 — 3y

Answer this question