I’ve been trying to make a F2P Leaderboard for the past 2 hours but I kept running into issues. I don’t know what to do anymore so I came here for help.
I made a folder inside the player called “Stats”. Inside that folder there is a BoolValue named “MoneyGamepass”. When the player gets the gamepass the BoolValue changes to true. I already scripted this. I just don’t know how to connect the BoolValue with the Leaderboard script.
Here is my current script: (I didn’t make this script and I can’t remember where I got it from.)
local dss = game:GetService("DataStoreService")
local ds = dss:GetOrderedDataStore("Data3")
local storedValueName = "Money"
local function Handler()
local Success, Err = pcall(function()
local Data = ds:GetSortedAsync(false, 100)
local Page = Data:GetCurrentPage()
for Rank, Data in ipairs(Page) do
local Name = Data.key
local Amount = Data.value
local NewObj = script.Template:Clone()
NewObj.PlrName.Text = Name
local retrievedValue = Data.value ~= 0 and (1.0000001 ^ Data.value) or 0
NewObj.Value.Text = Rounder(retrievedValue)
NewObj.Rank.Text = "#"..Rank
NewObj.Parent = script.Parent
end
end)
end
while wait(1) do
local timeUntilReset
timeUntilReset = timeUntilReset - 1
Refresh.Text = "Refreshes in: "..timeUntilReset.."s"
if timeUntilReset == 0 then
timeUntilReset = 300
for _,Player in pairs(game.Players:GetPlayers()) do
local storedValue = Player.Stats[storedValueName].Value ~= 0 and math.floor(math.log(Player.Stats[storedValueName].Value) / math.log(1.0000001)) or 0
ds:SetAsync(Player.Name, storedValue)
end
for _,v in pairs(script.Parent:GetChildren()) do
if v:IsA("Frame") then
v:Destroy()
end
end
Handler()
end
end