Hi Community, I am working on a game. I want to make a script that saves the leaderboard when a player left the game. I tried any Youtube tutorial, roblox wiki tutuorial, i tested a lot of scripts from the Toolbox but nothing helps. I tried this: (this is a leader board script)
SummitsData = game:GetService("DataStoreService"):GetDataStore("Summits") RankData = game:GetService("DataStoreService"):GetDataStore("rank") game.Players.PlayerAdded:Connect(function(plr) local LB = Instance.new("IntValue", plr) LB.Name = "leaderstats" local r = Instance.new("IntValue", LB) r.Name = "Summits" r.Value = SummitsData:GetAsync(plr.userId) or 0 local p = Instance.new("StringValue", LB) p.Name = "Rank" p.Value = RankData:GetAsync(plr.userId) or "Tourist" LB.Parent = plr p.Parent = LB r.Parent = LB end)
and I have this on the game settings: (This are Screenshots) https://www.bilder-upload.eu/bild-c72841-1550513805.png.html
https://www.bilder-upload.eu/bild-8cf6c4-1550513817.png.html
Do you have a solution?
Edit: When I copied the script from my screen I saw the two game files: game.ReplicatedFirst
andgame.ReplicatedStorage
and game.Networkclient
, must I add there something? Are one of this files a "must have" to do this?
Other Info: I saw this youtube tutorials: https://www.youtube.com/watch?v=Wcx7bVBEpCU https://www.youtube.com/watch?v=lS20iM7iRQE https://www.youtube.com/watch?v=c0S1XjD8KzQ https://www.youtube.com/watch?v=YlHNGEvoQNE