How can i make my board change tier up by one every 10 spree?

  1. i want to be able to have tier.value go up by one everytime a player gets 10 spree from their leaderstats

  2. i can’t seem to figure out how to make my board’s tier value go up by one everytime a player gets 10 spree from their leaderstats.

  3. i tried multiple solutions and i’m tired of trying so i wanna ask what can i do or what do i do to be able to? any idea or anything?

(UPDATED to the fixed version of the script i pasted the wrong one)

Part.Parent = workspace
wait(1)
local Key = workspace._DataStoreKey
local DS_Wins = "ds_wins".. Key.Value
local DS_Spree = "ds_spree".. Key.Value
local DS_Other = "ds_other".. Key.Value

local Players = game.Players

local Gui = Part.SurfaceGui
local List = Gui.ScrollingFrame
local Page = Gui.Page

local ReplicatedStorage = game.ReplicatedStorage

local function LoadPage(Player)
	local Bust = ReplicatedStorage.LocalBoardRemotes.GetBust:InvokeServer(Player.UserId)
	Page.ImageLabel.Image = Bust
	local leaderstats = Player.HiddenStats
	--local SavedWins = DS_Wins:GetAsync(Player.UserId)
	local SavedWins = leaderstats.HighestWins.Value -- use it to gather values
	Page.HighestWins.Text = "Highest Wins: ".. SavedWins
	--local SavedSpree = DS_Spree:GetAsync(Player.UserId)
	local SavedSpree = leaderstats.HighestSpree.Value
	Page.HighestSpree.Text = "Highest Spree: ".. SavedSpree

	--local SavedOther = DS_Other:GetAsync(Player.UserId)
	local SavedOther = ReplicatedStorage.LocalBoardRemotes.GetData:InvokeServer(DS_Other.Value, Player.UserId) or {0,0,0}
	Page.TotalWins.Text = "Total Wins: ".. SavedOther[2]
	Page.Deaths.Text = "Deaths: ".. SavedOther[3]
	Page.KDR.Text = "KDR: ".. SavedOther[2]/SavedOther[3]

	if SavedOther[4] then 

		Page.ArenaWins.Text = "Arena Wins: ".. SavedOther[4] --no more error 

	end 

	Page.ImageLabel.name.Text = Player.Name
	if SavedSpree.Value == 10 then
		Page.ImageLabel.Tier.Text = "Tier ".. SavedSpree.Value
	else
		Page.ImageLabel.Tier.Text = "Tier ".. ((math.floor(SavedSpree.Value / 10)) + 1) -- Every Tier = 10 sprees
	end
end

local function Update()
	for _,v in pairs(List:GetChildren()) do
		if v:IsA("TextButton") then
			v:Destroy()
		end
	end
	for _,v in pairs(Players:GetChildren()) do
		local Button = script.TextButton:Clone()
		Button.Text = v.Name
		Button.Parent = List
		Button.MouseButton1Down:Connect(function()
			Update()
			LoadPage(v)
			Page.Visible = true
		end)
	end
end

Players.PlayerAdded:Connect(function() wait(1) Update() end)
Players.PlayerRemoving:Connect(function() wait(1) Update() end)

-- Get the current time
while task.wait(1) do
	Update()
end
1 Like

yea i fixed the issue i had earlier just now but still same issue of it not changing tier value

This should work, I change the math.floor function a bit.

Page.ImageLabel.Tier.Text = "Tier ".. math.floor(SavedSpree.Value / 10) -- Every Tier = 10 sprees

Basically it will always round down to the nearest whole number unless the number of sprees is a multiple of 10 (10, 20, 30, 40, etc.)
I’m not sure if the if statement above this line is needed.

nah doesn’t work. tier value only shows the number 1 when i change my spree to 10

Oh didn’t know it’s supposed to start at 1, just change SavedSpree.Value to (SavedSpree.Value + 1)


still isn’t working

maybe try doing an + 1 to the math.flood(SavedSpree.Value / 10)? Something like Page.ImageLabel.Tier.Text = "Tier ".. (math.floor(SavedSpree.Value / 10) + 1) since when you do 10/10 it would give you 1, and you want 2, so just offset it by 1.

updated my code and it works but.
issues still

and what i said previously, i have no idea how to do it cause someone made me this server-sided leaderboard for me years ago and he’s no longer active

Replace the LoadPage function with this modified one:

local function LoadPage(Player)
	local Bust = ReplicatedStorage.LocalBoardRemotes.GetBust:InvokeServer(Player.UserId)
	Page.ImageLabel.Image = Bust
	local leaderstats = Player.HiddenStats
	local SavedWins = leaderstats.HighestWins.Value
	Page.HighestWins.Text = "Highest Wins: ".. SavedWins
	local SavedSpree = leaderstats.HighestSpree.Value
	Page.HighestSpree.Text = "Highest Spree: ".. SavedSpree
	local tier = math.floor(SavedSpree/10) + 1
	Page.ImageLabel.Tier.Text = "Tier ".. tier

	local SavedOther = ReplicatedStorage.LocalBoardRemotes.GetData:InvokeServer(DS_Other, Player.UserId) or {0,0,0}
	Page.TotalWins.Text = "Total Wins: ".. SavedOther[2]
	Page.Deaths.Text = "Deaths: ".. SavedOther[3]
	Page.KDR.Text = "KDR: ".. SavedOther[2]/SavedOther[3]

	if SavedOther[4] then 
		Page.ArenaWins.Text = "Arena Wins: ".. SavedOther[4]
	end 
end

It’s basically what ExpiredBreaad was saying to do, but I put it into the code so you don’t put it in the wrong place

1 Like

omg that worked perfectly. But why is the other stats like total wins and deaths stopped showing their stats on the board?

got it. thank you both for helping out.

finally got it 100% lol thank you guys

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.