I have a table which has cars the player has bought, but when i load all the values all of them return false instead of true but i set it to true when i left the game, here is how i save my data:
local DataTable = {}
– when player joins i give them these values:
DataTable[player.UserId] = {
["Car2023"] = {
["Haas"] = false,
["Williams"] = false,
["AlfaRomeo"] = false,
["Alpine"] = false,
["Mclaren"] = false,
["Ferrari"] = false,
["AstonMartin"] = false,
["Mercedes"] = false,
["Redbull"] = false
}
}
game:BindToClose(function()
for i, player in pairs(Players:GetChildren()) do
ItemStore:SetAsync(player.UserId, DataTable[player.UserId])
end
end)
Players.PlayerRemoving:Connect(function(player)
ItemStore:SetAsync(player.UserId, DataTable[player.UserId])
end)