I'm making a simulator in Roblox but I don't know how to save the leaderboard stats. To clarify, if someone leaves and rejoins, they will have to start all the way from the beginning. This is the leaderboard script.
local DataStore = game:GetService("DataStoreService")
local PointsData = DataStore:GetOrderedDataStore("Points")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local energy = Instance.new("NumberValue")
energy.Name = "Energy"
energy.Parent = leaderstats
local coin = Instance.new("NumberValue")
coin.Name = "LazerBux"
coin.Parent = leaderstats
end)

2 comments
You would have to save their stats when they leave as well as load them when they join.
Yea but the thing is I don't know how to script.