I've started to get to grips with DataStore but I don't want the values I have stored to appear on the leaderboard - I just want them to be stored so they can appear elsewhere (i.e, a GUI). How would I do this?
local DataStore = game:GetService("DataStoreService"):GetDataStore("Stats")
game.Players.PlayerAdded:connect(function(player)
local stats = Instance.new("IntValue", player)
stats.Name = "leaderstats" --Would I change this?
local gold = Instance.new("IntValue", stats)
gold.Name = "Gold"
local key = "player-"..player.userId
local savedStats = DataStore:GetAsync(key)
if savedStats then
gold.Value = savedStats[1]
else
local newStats = {gold.Value}
DataStore:SetAsync(key, newStats)
end
end)
^Just testing it now which is why I only have one variable stored
