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

How can I save and load point stats?

Asked by 4 years ago

I need help with saving a point system and it loading when someone rejoins. Here's what I'm using to add 1 point every 10 seconds:

amount = 1
timedelay = 10
currencyname = "Points"

while true do
    wait(timedelay)
    for i,v in pairs(game.Players:GetPlayers()) do
        if v:FindFirstChild("leaderstats") and v then
            v.leaderstats[currencyname].Value = v.leaderstats[currencyname].Value + amount
        end
    end
end

1 answer

Log in to vote
1
Answered by
Norbunny 555 Moderation Voter
4 years ago
Edited 4 years ago

In order to save and load previously saved data on Roblox, you need to using datastores.

it's a quite advanced topic, so it might take you a while to get there, but once you get the hang of it, it's easy!

I would give you some example code, but it's extensive, there's good tutorials on YouTube with things explained step by step. A good one is by AlvinBox, found here

Ad

Answer this question