In a script, i've used the DataStoreService, to allow my game to save data. It perfectly works until the use of GetAsync.

Here's the part that doesnt work :

game.Players.PlayerAdded:Connect(function(player)

local plrID = "player_"..player.userId
local playerLevel = DSService:GetDataStore("plrLevel")

local GetLevel = playerLevel:GetAsync(plrID)

level.Value = GetLevel[1] or 1 -- this ain't working. Also, i did put the [1] to every values (GetExp[1] or 0 ; GetStamina[1] or 0 , etc....)

end)

1 comment

0

the value you saved with SetAsync or UpdateAsync must be nil. you should be checking if GetLevel isnt nil before trying to index anything inside it