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

Why is it saying I can't save a nil value?

Asked by 5 years ago

For some reason I can not save or retrieve data in my script.

Here it is:

if marketS:UserOwnsGamePassAsync(Player.UserId,7110587) then 
    local GangStats = GangStats:GetAsync(70)
    local LowestGangId = GangStats.LowestGangId
    local NewId = LowestGangId + 1 
    local DataToSave = 
    {
        LowestGangId = NewId
    }
    GangStats:SetAsync(70,DataToSave)
    Player.GangStats.GangRank.Value = "Leader"
    Player.GangStats.GangId.Value = NewId
    local DataToSave2 = 
    {
        GangId = NewId,
        OwnerId = Player.UserId,
        Members = 1
    }
    GangStore:SetAsync(NewId,DataToSave2)
    addGang(NewId,Description)
end

For whatever reason, it is saying I am calling a nil value where it says GangStats:SetAsync(70,DataToSave)

1 answer

Log in to vote
0
Answered by
St_vnC 330 Moderation Voter
5 years ago

Go check every value or something by printing to check if something is actually nil

Ad

Answer this question