How do I save the values/string of a leaderboard stat and have it load the next time the player joins the game? The following is the script I will be using for my game:
game.Player.PlayerAdded:connect(plr)
local leaderstats = Instance.new("Model",plr)
leaderstats.Name = "leaderstats"
local lvl = Instance.new("IntValue", leaderstats)
lvl.Name = "LVL"
lvl.Value = 1
local currency = Instance.new("IntValue", leaderstats)
currency.Name = "Gold"
currency.Value = 100
end)
I would like you to edit this script so that it could save and load the next time the player joins. I would also like you to elaborate the workings of saving and loading values (when I tried to check the roblox wiki, something about Data store came up but I don't really understand).

14 comments
Thanks! :D
Can you atleast give me what I wanted for my script?
Sure.
Question: for the while wait(5) do part, does that save the currency value every 5 seconds and not everything else?
Yea, you would have to set up nother datastore table or something to make it save the lvl.
So... Basicly the same as lines 15-17, except that instead of currency.Value, it's lvl?
yes
Thanks! :D
np
Accept my answer please! :D
4 Years And Your Answer Wasn't Accepted But Works.
Another year goes by and his answer still hasn't been accepted, sadness.
Truth CodedStars lol.
Truth CodedStars lol.