Im trying to make an inventory system where people can get different colors and faces, and this will save. To save it, im trying to add values in player that save, but it will start getting messy and might break when I get to a lot of values. If anyone can give me a datastore they use for their inventories, that would help a lot! Thank you for any help! Here is my saving leaderboard script:
local datastore = game:GetService("DataStoreService")
local ds1 = datastore:GetDataStore("KillsaveSystem")--change all "kills" to what value you want and keep doing it
local ds2 = datastore:GetDataStore("CashSaveSystem")--change all "cash" to what value you want and keep doing it
game.Players.PlayerAdded:Connect(function(plr)
local folder = Instance.new("Folder", plr)
folder.Name = "leaderstats"
local Kills = Instance.new("IntValue", folder)
Kills.Name = "Kills"
local cash = Instance.new("IntValue", folder)
cash.Name = "Cash"
Kills.Value = ds1:GetAsync(plr.UserId) or 0
ds1:SetAsync(plr.UserId, Kills.Value)
cash.Value = ds2:GetAsync(plr.UserId) or 0
ds2:SetAsync(plr.UserId, cash.Value)
end)
game.Players.PlayerRemoving:Connect(function(plr)
ds1:SetAsync(plr.UserId, plr.leaderstats.Kills.Value)
ds2:SetAsync(plr.UserId, plr.leaderstats.Cash.Value)
end)
