HOW TO MAKE A LEADERSTATS WITH A SAVING SYSTEM Roblox Scripting Tutorial

Опубликовано: 29 Июль 2026
на канале: Scripting Tutorials
436
5

HOW TO MAKE A LEADERSTATS WITH A SAVING SYSTEM Roblox Scripting Tutorial
if the scripts dont work lemme know in the comments so i can fix it!
This Is The Save Data Script

local ds = game:GetService("DataStoreService"):GetDataStore("SaveData")
game.Players.PlayerAdded:Connect(function(plr)
wait()
local plrkey = "id_"..plr.userId
local save1 = plr.leaderstats.Cash
local save2 = plr.leaderstats.Strength

local GetSaved = ds:GetAsync(plrkey)
if GetSaved then
save1.Value = GetSaved[1]
save2.Value = GetSaved[2]
else
local NumberForSaving = {save1.Value, save2.Value}
DS:GetAsync(plrkey, NumberForSaving)
end
end)

ds:SetAsync("id_"..plr.userId, {plr.leaderstats.Cash.Value, plr.leaderstats.Strength.Value})
end)

This Is The Leaderstat Script

game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player

local strength = Instance.new("IntValue")
strength.Name = "Strength"
strength.Value = 0 -- change it if u want not a big number or it wont work
strength.Parent = leaderstats

local cash = Instance.new("IntValue")
cash.Name = "Cash"
cash.Value = 0 -- change it if u want not a big number or it wont work
cash.Parent = leaderstats

LIKE AND SUB FOR MORE TUTORIALS LIKE THIS BYEEE