i want to be able to have tier.value go up by one everytime a player gets 10 spree from their leaderstats
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.
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
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.
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.