Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local datastore = game:GetService("DataStoreService")
- local ds1 = datastore:GetDataStore("GemSaveSystem")
- local ds2 = datastore:GetDataStore("CashSaveSystem")
- game.Players.PlayerAdded:connect(function(plr)
- local folder = Instance.new("Folder", plr)
- folder.Name = "leaderstats"
- local gems = Instance.new("IntValue", folder)
- gems.Name = "Coins"
- local cash = Instance.new("IntValue", folder)
- cash.Name = "Strengh"
- gems.Value = ds1:GetAsync(plr.UserId) or 0
- ds1:SetAsync(plr.UserId, gems.Value)
- cash.Value = ds2:GetAsync(plr.UserId) or 0
- ds2:SetAsync(plr.UserId, cash.Value)
- gems.Changed:connect(function()
- ds1:SetAsync(plr.UserId, gems.Value)
- end)
- cash.Changed:connect(function()
- ds2:SetAsync(plr.UserId, cash.Value)
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement