BillboardGui does not get updated by script

I have not read the whole thread, but why not just have a .Changed event fire whenever the player’s donate amount changes?

Had to learn this with a tutorial but it’s working.

local Ranks = {
	Rank1 = {Name  = "Poor Donator: I",AmountNeeded = 0}, -- Name, Needed
	Rank2 = {Name = "Causal Donator: II", AmountNeeded = 25},
	Rank3 = {Name = "Decent Donator: III", AmountNeeded = 50},
	Rank4 = {Name = "Good Donator: IV", AmountNeeded = 200},
	Rank5 = {Name = "Very Good Donator: V", AmountNeeded = 500},
	Rank6 = {Name = "Insane--- Donator: VI", AmountNeeded = 1000},
	Rank7 = {Name = "Insane-- Donator: VII", AmountNeeded = 5000},
	Rank8 = {Name = "Insane Donator: VIII", AmountNeeded = 10000},
	Rank9 = {Name = "OMEGA Donator: IX", AmountNeeded = 20000},
	Rank10 = {Name = "OMEGA+++ Donator: X", AmountNeeded = 100000},
}

local function UpdateRank(plr,char,BillBoardClone)
	local plr = game:GetService("Players"):FindFirstChildOfClass("Player")
	local Donated = plr.leaderstats.Donated
	local function IsInRange(minimum: number, maximum: number)
		return math.clamp(Donated.Value, minimum, maximum)
	end
	Donated.Value = 5e6
	BillBoardClone.Frame.PlayerName.Text = plr.Name


	local function comma(amount)
		while true do
			amount, k = string.gsub(amount, "^(-?%d+)(%d%d%d)",'%1,%2')
			if (k == 0) then
				break
			end
		end
		return amount
	end
	BillBoardClone.Frame.PlayerAmount.Text = comma(plr.leaderstats.Donated.Value).." Robux Donated"
	while task.wait() do
		if Donated.Value <= 24.99 then
			BillBoardClone.Frame.Rank.Text = Ranks.Rank1.Name
		elseif Donated.Value == IsInRange(25,49) then
			BillBoardClone.Frame.Rank.Text = Ranks.Rank2.Name
		elseif Donated.Value == IsInRange(50,99) then
			BillBoardClone.Frame.Rank.Text = Ranks.Rank3.Name
		elseif Donated.Value == IsInRange(100,199) then
			BillBoardClone.Frame.Rank.Text = Ranks.Rank4.Name
		elseif Donated.Value == IsInRange(200,499) then 
			BillBoardClone.Frame.Rank.Text = Ranks.Rank5.Name	
		elseif Donated.Value == IsInRange(1000,4999) then 
			BillBoardClone.Frame.Rank.Text = Ranks.Rank6.Name	
		elseif Donated.Value == IsInRange(5000,9999) then 
			BillBoardClone.Frame.Rank.Text = Ranks.Rank7.Name	
		elseif Donated.Value == IsInRange(10000,19999) then 
			BillBoardClone.Frame.Rank.Text = Ranks.Rank8.Name
		elseif Donated.Value == IsInRange(20000,99999) then 
			BillBoardClone.Frame.Rank.Text = Ranks.Rank9.Name
		elseif Donated.Value >= 100000 then
			BillBoardClone.Frame.Rank.Text = Ranks.Rank10.Name
		end
		return comma
	end
end

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		wait(2)
		local BillBoardClone = game.ServerStorage.PlayerRank:Clone()
		BillBoardClone.Name = "PlayerRank"
		BillBoardClone.Parent = char.Head
		coroutine.wrap(UpdateRank)(plr,char,BillBoardClone)
	end)
end)

return {UpdateRank == UpdateRank}

I mean, the amount is working, but not the changed value.

So, I made it work again:

local Ranks = {
	Rank1 = {Name  = "Poor Donator: I",AmountNeeded = 0}, -- Name, Needed
	Rank2 = {Name = "Causal Donator: II", AmountNeeded = 25},
	Rank3 = {Name = "Decent Donator: III", AmountNeeded = 50},
	Rank4 = {Name = "Good Donator: IV", AmountNeeded = 200},
	Rank5 = {Name = "Very Good Donator: V", AmountNeeded = 500},
	Rank6 = {Name = "Insane--- Donator: VI", AmountNeeded = 1000},
	Rank7 = {Name = "Insane-- Donator: VII", AmountNeeded = 5000},
	Rank8 = {Name = "Insane Donator: VIII", AmountNeeded = 10000},
	Rank9 = {Name = "OMEGA Donator: IX", AmountNeeded = 20000},
	Rank10 = {Name = "OMEGA+++ Donator: X", AmountNeeded = 100000},
}

local function UpdateRank(plr,char,BillBoardClone)
	local plr = game:GetService("Players"):FindFirstChildOfClass("Player")
	local Donated = plr.leaderstats.Donated
	local function IsInRange(minimum: number, maximum: number)
		return math.clamp(Donated.Value, minimum, maximum)
	end

	BillBoardClone.Frame.PlayerName.Text = plr.Name

	local function comma(amount)
		while true do
			amount, k = string.gsub(amount, "^(-?%d+)(%d%d%d)",'%1,%2')
			if (k == 0) then
				break
			end
		end
		return amount
	end
	BillBoardClone.Frame.PlayerAmount.Text = comma(plr.leaderstats.Donated.Value).." Robux Donated"
	while task.wait() do
		plr.leaderstats.Donated:GetPropertyChangedSignal("Value"):Connect(function()
			BillBoardClone.Frame.PlayerAmount.Text = comma(plr.leaderstats.Donated.Value).." Robux Donated"
		end)
		if Donated.Value <= 24.99 then
			BillBoardClone.Frame.Rank.Text = Ranks.Rank1.Name
		elseif Donated.Value == IsInRange(25,49) then
			BillBoardClone.Frame.Rank.Text = Ranks.Rank2.Name
		elseif Donated.Value == IsInRange(50,99) then
			BillBoardClone.Frame.Rank.Text = Ranks.Rank3.Name
		elseif Donated.Value == IsInRange(100,199) then
			BillBoardClone.Frame.Rank.Text = Ranks.Rank4.Name
		elseif Donated.Value == IsInRange(200,499) then 
			BillBoardClone.Frame.Rank.Text = Ranks.Rank5.Name	
		elseif Donated.Value == IsInRange(1000,4999) then 
			BillBoardClone.Frame.Rank.Text = Ranks.Rank6.Name	
		elseif Donated.Value == IsInRange(5000,9999) then 
			BillBoardClone.Frame.Rank.Text = Ranks.Rank7.Name	
		elseif Donated.Value == IsInRange(10000,19999) then 
			BillBoardClone.Frame.Rank.Text = Ranks.Rank8.Name
		elseif Donated.Value == IsInRange(20000,99999) then 
			BillBoardClone.Frame.Rank.Text = Ranks.Rank9.Name
		elseif Donated.Value >= 100000 then
			BillBoardClone.Frame.Rank.Text = Ranks.Rank10.Name
		end
	end
end

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		wait(2)
		local BillBoardClone = game.ServerStorage.PlayerRank:Clone()
		BillBoardClone.Name = "PlayerRank"
		BillBoardClone.Parent = char.Head
		coroutine.wrap(UpdateRank)(plr,char,BillBoardClone)
	end)
end)

return {UpdateRank == UpdateRank}

71 lines, wow.

OK the value of the leaderboard keeps changing, idk if its on client or what but i will mark this as a solution
i will figure out what the problem why the stats keep breaking

It’s on ServerScriptService, but it’s okay.

Change the RunContext to Client.

It was making sure if it worked (and it did).

bruh why did you put this line

Donated.Value = 5e6

this is the reason why it didnt work

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