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

Data Persistance Leaderboard Won't Work? I fixed Some Problems.

Asked by 10 years ago
game.Players.PlayerAdded:connect(function(player)
    player:WaitForDataReady()   
    print("Player Data Ready")
    leaderstats = Instance.new("IntValue")
    leaderstats.Parent = player
    leaderstats.Name = "leaderstats"

    SecondsPlayed = Instance.new("IntValue")
    SecondsPlayed.Parent = leaderstats
    SecondsPlayed.Name = "Seconds Played"
    SecondsPlayed.Value = 0
    SecondsPlayed.Value = player:LoadNumber("SecondsPlayed")
    while wait(1) do
        SecondsPlayed.Value = SecondsPlayed.Value +1
    end 
end)

game.Players.PlayerRemoving:connect(function(player)
    player:SaveNumber("SecondsPlayed", player.leaderstats.SecondsPlayed.Value)
end)

1 answer

Log in to vote
0
Answered by 10 years ago

I can offer some advice, remove lines 13-15 and make a seperate script to put inside the value, inside the second script put.

while true do
wait(1)
script.Parent.Value = script.Parent.Value+1

If this worked thumbs up the answer :)

Ad

Answer this question