Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would I make a triple saving leaderstats? (Gold, Exp, Level)

I know how to make double save, but not triple. I’ve looked for it on YouTube but can’t find one. Can someone help me?

1 comment

0

can i have the double save

1 answer

✓ Accepted answer
local datastore = game:GetService("DataStoreService")
local ds1 = datastore:GetDataStore("GoldSaveSystem")
local ds2 = datastore:GetDataStore("ExpSaveSystem")
local ds3 = datastore:GetDataStore("LevelSaveSystem")

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 Exp = Instance.new("IntValue", folder)
 Exp.Name = "Exp"
 local Level = Instance.new("IntValue", folder)
 Level.Name = "Level"
 
 Gold.Value = ds1:GetAsync(plr.UserId) or 0
 ds1:SetAsync(plr.UserId, Gold.Value)
 
 Exp.Value = ds2:GetAsync(plr.UserId) or 0
 ds2:SetAsync(plr.UserId, Exp.Value)
 
Level.Value = ds3:GetAsync(plr.UserId) or 0
 ds3:SetAsync(plr.UserId, Level.Value)

 Gold.Changed:connect(function()
  ds1:SetAsync(plr.UserId, Gold.Value)
 end)
 
 Exp.Changed:connect(function()
  ds2:SetAsync(plr.UserId, Exp.Value)
 end)

Level.Changed:connect(function()
  ds3:SetAsync(plr.UserId, Level.Value)
 end)
end)

this works it also creates the leaderstats as well

1 comment

0

Thanks mate

This discussion is preserved as it was. New answers, comments, and votes are closed.