local data = game:GetService("DataStoreService"):GetDataStore("Saves")
local data = game:GetService("DataStoreService"):GetDataStore("Gold")
local settings={
groupid = 2903819
}
game:GetService("Players").PlayerAdded:connect(function(player)
local key = "user_"..player.UserId
local leaderstats = Instance.new("Folder", player)
leaderstats.Name = "leaderstats"
local rank = Instance.new("StringValue", leaderstats)
rank.Name = "Rank"
rank.Value = player:GetRoleInGroup(settings["groupid"])
local GetPlayerSave = data:GetAsync("user_"..player.UserId)
local points = Instance.new("NumberValue", leaderstats)
points.Name = "Saves"
if GetPlayerSave then
points.Value = GetPlayerSave[1] or 0
else
points.Value = 0
end
local points = Instance.new("NumberValue", leaderstats)
points.Name = "Gold"
if GetPlayerSave then
points.Value = GetPlayerSave[1] or 0
else
points.Value = 0
end
end)
game:GetService("Players").PlayerRemoving:connect(function(player)
local leaderstats = player:WaitForChild("leaderstats")
local ToSave = {leaderstats.Saves.Value}
local ToSave = {leaderstats.Gold.Value}
data:SetAsync("user_"..player.UserId, ToSave)
end)
I want two things to save, Saves and Gold, both don't seem to work now despite it was working before when it had one value.

5 comments
Just for example, also could you explain further by showing me via script of what I did wrong? It would help me a lot, thanks!
local points = Instance.new("NumberValue", leaderstats) was doubled, I believe, therefor it's been doubling.Then how would I add a second value to the leaderboard stats in order for it to save?
Make a seperate variable for Line 16, instead of taking the name of Gold.
You think you could code it to show me? I really have a hard time understanding sometimes, I'm sorry!