Here's my leaderstats so far
local DataStore = game:GetService("DataStoreService") local StatData = DataStore:GetDataStore("PlayerStats") local CartData = DataStore:GetDataStore("Carts") game.Players.PlayerAdded:connect(function(player) local getStatData = StatData:GetAsync(player.userId) local leaderboard = Instance.new("Folder",player) leaderboard.Name = "leaderstats" local level = Instance.new("IntValue",leaderboard) level.Name = "Level" local coins = Instance.new("IntValue",leaderboard) coins.Name = "Coins" if getStatData then level.Value = getStatData[1] coins.Value = getStatData[2] else StatData:SetAsync(player.userId, {1,200}) end while wait(20) do StatData:SetAsync(player.userId, {level.Value,coins.Value}) end end)
My question is, I'm making carts that people buy and upgrade, and whatever you do saves. I was wondering if there was a way I could do like,
for i,v in pairs()
and get a whole group a values and save/load them together instead of individually. I am very new to DataStore so sorry if this is an easy solution.