Delete the IntValues inside of the script (Sounds weird, but trust me). Put this script in a ServerScript in ServerScriptService
local datastore = game:GetService("DataStoreService")
local ds1 = datastore:GetDataStore("GoldSaveSystem")
local ds2 = datastore:GetDataStore("SilverSaveSystem")
local ds3 = datastore:GetDataStore("CopperSaveSystem")
game.Players.PlayerAdded:Connect(function(plr)
local folder = Instance.new("Folder", plr)
folder.Name = "leaderstats"
local Gold = Instance.new("IntValue", folder)
Gold.Name = "Gold"
local Silver = Instance.new("IntValue", folder)
Silver.Name = "Silver"
local Copper = Instance.new("IntValue", folder)
Copper.Name = "Copper"
Gold.Value = ds1:GetAsync(plr.UserId) or 0
ds1:SetAsync(plr.UserId, Gold.Value)
Silver.Value = ds2:GetAsync(plr.UserId) or 0
ds2:SetAsync(plr.UserId, Silver.Value)
Copper.Value = ds3:GetAsync(plr.UserId) or 0
ds3:SetAsync(plr.UserId, Copper.Value)
Gold.Changed:Connect(function()
ds1:SetAsync(plr.UserId, Gold.Value)
end)
Silver.Changed:Connect(function()
ds2:SetAsync(plr.UserId, Silver.Value)
end)
Copper.Changed:Connect(function()
ds3:SetAsync(plr.UserId, Copper.Value)
end)
end)
6 comments
When they leave, unique key is nil.
wait nvm
userId should be UserId
Also, you save copper twice.
Oh, haha, thanks, I'll look into those
Don't come on this site with alvinbloxx's code, expecting for it to be fixed. Write your own scripts.