Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My leaderboards dosen't save. :-: I've tried everything! What am i doing wrong!?

Asked by 4 years ago

Okey, so i made a leaderboard saveing script, but it dosen't work! I've tried literally everything!

Leaderboard Is in game.Players.Localplayer.Leaderstats.Level

This is the script:


game.Players.PlayerRemoving:connect(function(player) local datastore = game:GetService("DataStoreService"):GetDataStore(player.Name.."Stats")

local statstorage = player:FindFirstChild("leaderstats"):GetChildren() for i = 1, #statstorage do datastore:SetAsync(statstorage[i].Name, statstorage[i].Value)

end print("Stats successfully saved")
end)

game.Players.PlayerAdded:connect(function(player) local datastore = game:GetService("DataStoreService"):GetDataStore(player.Name.."Stats")

player:WaitForChild("leaderstats")
wait(1)
local stats = player:FindFirstChild("leaderstats"):GetChildren()
for i = 1, #stats do            
stats[i].Value = datastore:GetAsync(stats[i].Name)
    end

end)


Ty so much if you help me! :-:

0
*..If you helped me!.. tottero5 0 — 4y
0
Could you put the whole script in the code block, please Dominus_ARA 24 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Watch this video:www.youtube.com/watch?v=Wcx7bVBEpCU It worked for me, so I'm sure it will work for you too.

0
It didn't work :-: tottero5 0 — 4y
0
You must not be doing something properly then. Check the comments of that video. I believe there may have been one error in there somewhere. corncob567 275 — 4y
Ad

Answer this question