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

Help for a leaderboard datastore ?

Asked by 6 years ago
Edited 6 years ago

Hi ! i need help with my leaderboard, is work but when i leave the server the Time Played return to 0.. i want save my progression with datastore but i don't know how it's work ? Thanks for help :)

function onPlayerEntered(Player)

    local stats = Instance.new("IntValue")
    stats.Name = "leaderstats"

    local secs = Instance.new("IntValue")
    secs.Name = "Time Played"
    secs.Value = 0


    secs.Parent = stats

    stats.Parent = Player

    while true do
        secs.Value = secs.Value + 1
        wait(1)
    end
end

game.Players.ChildAdded:connect(onPlayerEntered)

0
watch peaspod's tutorial INOOBE_YT 387 — 6y
0
PeasPod's videos are old and will contain deprecated code. At least today they are. User#19524 175 — 6y

1 answer

Log in to vote
0
Answered by
Mr_Unlucky 1085 Moderation Voter
6 years ago

Click here.

0
I have see this video but i don’t know where i can insert the code: while true do... for add seconds to leaderboard, i have tried to place this after and before the code in the video but it’s not work.. Thorngard 4 — 6y
0
Create a script into the ServerScriptService service, which should be in the explorer. Then, paste the script in. Mr_Unlucky 1085 — 6y
Ad

Answer this question