✓ Accepted answer
Okay. Here is an example script. Put these in both games, If you make the one game to the starter place and use this datastore script. Both leaderboards will save to each other (Put script it both games in serverscriptservice)
local DataStore = game:GetService("DataStoreService")
local ScoopizWoopiz = DataStore:GetDataStore("HeyItzScoopWasHere")
game.Players.PlayerAdded:connect(function(player)
local leader = Instance.new("Folder", player)
leader.Name = "leaderstats"
local Money = Instance.new("IntValue", leader)
Money.Name = "Money"
Money.Value = ScoopizWoopiz:GetAsync(player.UserId) or 0
ScoopizWoopiz:SetAsync(player.UserId, Money.Value)
Money.Changed:connect(function()
print("SavingData")
ScoopizWoopiz:SetAsync(player.UserId, Money.Value)
end)
end)
game.Players.PlayerRemoving:connect(function(player)
ScoopizWoopiz:setAsync(player.UserId, player.leaderstats.Money.Value)
end)
2 comments
well, thanks for example but it's even more complicated than this. it's more than 20 values.
No problem dude!