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)
Unfortunately, there is no way to save direct assets like there was with DataPersistance. However, what you can do is make a bool value for every asset you want and then save and load the value of the bool when they enter and save. You then can copy the asset that you want over to the player only if the bool of that asset is true when they enter.
You can save everything there, I recommend using folders to save in your case.