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

leaderstats save error.? plz help

Asked by 3 years ago

local ds = game:GetService("DataStoreService"):GetDataStore("SaveData") game.Players.PlayerAdded:Connect(function(player) wait() local playerkey = "id_"..player.userId local moneh = player.leaderstats.Cash

local saving = ds:GetAsync(playerkey)
if saving then
    moneh.Value = saving[1]
else
    local idsaving = {moneh.Value}
    ds:GetAsync(playerkey, idsaving)
end

end)

game.Players.PlayerRemoving:Connect(function(player) ds:SetAsync("id_"..player.usedId,{player.leaderstats.Cash.Value}) end)

ERROR:usedId is not a valid member of Player "Players.Not_Paulo" translation: the userId isnt a child of player

how to fix plz.?

Answer this question