I have created a script that saves players points and all but how do i make it save players stuff like hats and to their inventory, sorry i'm still learning Lua.
local DataStore = game:GetService("DataStoreService"):GetDataStore("Shop")
game.Players.PlayerRemoving:connect(function(player)
local key = "player-"..player.userId
--Save key: {points, coins}
local valuesToSave = {player.leaderstats.Points.Value, player.leaderstats.Coins.Value}
DataStore:SetAsync(key, valuesToSave)
end)
