local ds = game:GetService("DataStoreService")
local coinsODS = ds:GetOrderedDataStore("BreathsStats")
local timeUntilReset = 10
while wait(1) do
timeUntilReset = timeUntilReset - 1
script.Parent.Parent.ResetTime.Text = "Resetting in " .. timeUntilReset .. " seconds..."
if timeUntilReset == 0 then
timeUntilReset = 10
for i, plr in pairs(game.Players:GetPlayers()) do
coinsODS:SetAsync(plr.UserId, plr.leaderstats.Breaths.Value)
end
for i, leaderboardRank in pairs(script.Parent:GetChildren()) do
if leaderboardRank.ClassName == "Frame" then
leaderboardRank:Destroy()
end
end
local success, errorMsg = pcall(function()
local data = coinsODS:GetSortedAsync(false, 50)
local coinsPage = data:GetCurrentPage()
for rankInLB, dataStored in ipairs(coinsPage) do
local name = game.Players:GetNameFromUserIdAsync(tonumber(dataStored.key))
local breaths = dataStored.value
local template = script.Template:Clone()
template.Name = name .. "Leaderboard"
template.PlrName.Text = name
template.Rank.Text = "#" .. rankInLB
template.breaths.Text = breaths
template.Parent = script.Parent
end
end)
end
end
I got this script from youtube and I’m trying to make it where the leaderboard shows as Breaths but when I tried to change it, it wouldn't work? can someone help?
here is my datatstore script
local Data = game:GetService("DataStoreService"):GetOrderedDataStore("BreathsStats")
game.Players.PlayerAdded:Connect(function(plr)
local folder = Instance.new("Folder", plr)
folder.Name = "leaderstats"
local Breaths = Instance.new("IntValue", folder)
Breaths.Name = "Breaths"
Breaths.Value = 0
local dataLoad = Data:GetAsync(tostring(plr.UserId))
if dataLoad then
Breaths.Value = dataLoad
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
Data:SetAsync(tostring(plr.UserId),
plr.leaderstats.Breaths.Value
)
end)

8 comments
which video
https://www.youtube.com/watch?v=MStpvEp2q7g
Habe you noticed that, template.breaths.Text = breaths should be template.breaths.Text = "breaths"
He's setting the breaths text to breaths which is variable he set.
Are there any errors @RareBlue?
no
OH GOD NOT A CORONA VIRUS SIMULATOR
its not lmaooo