BillboardGui does not get updated by script

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

i want to make that a script creats a billboardgui on the players head and a function that keeps updating it

  1. What is the issue? Include screenshots / videos if possible!

the billboardGui does not update when i test it

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

no

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

here is the script

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)
	while task.wait() do
		local Donated = plr.leaderstats.Donated
		BillBoardClone.Frame.PlayerName.Text = plr.Name
		if Donated.Value == 0 then
			BillBoardClone.Frame.Rank.Text = Ranks.Rank1.Name
		elseif Donated.Value >= 25 then
			BillBoardClone.Frame.Rank.Text = Ranks.Rank2.Name
		elseif Donated.Value >= 50 then
			BillBoardClone.Frame.Rank.Text = Ranks.Rank3.Name
		elseif Donated.Value >= 200 then
			BillBoardClone.Frame.Rank.Text = Ranks.Rank4.Name
		elseif Donated.Value >= 500 then 
			BillBoardClone.Frame.Rank.Text = Ranks.Rank5.Name	
		elseif Donated.Value >= 1000 then 
			BillBoardClone.Frame.Rank.Text = Ranks.Rank6.Name	
		elseif Donated.Value >= 5000 then 
			BillBoardClone.Frame.Rank.Text = Ranks.Rank7.Name	
		elseif Donated.Value >= 10000 then 
			BillBoardClone.Frame.Rank.Text = Ranks.Rank8.Name
		elseif Donated.Value >= 20000 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)

here is the explorer
image

tell me if you need more stuff

here is the gui (tesing on another account)

image

here is the leaderstat
image

(Dont ask me how i have 5M donated its on roblox studio i didnt actually spend 5m robux)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Can you put a localfile please?

the file of the place? or what

Yeah, the file of the place, that you’re editing.

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 Donated = plr.leaderstats.Donated
	BillBoardClone.Frame.PlayerName.Text = plr.Name
	if Donated.Value == 0 then
		BillBoardClone.Frame.Rank.Text = Ranks.Rank1.Name
	elseif Donated.Value >= 25 then
		BillBoardClone.Frame.Rank.Text = Ranks.Rank2.Name
	elseif Donated.Value >= 50 then
		BillBoardClone.Frame.Rank.Text = Ranks.Rank3.Name
	elseif Donated.Value >= 200 then
		BillBoardClone.Frame.Rank.Text = Ranks.Rank4.Name
	elseif Donated.Value >= 500 then 
		BillBoardClone.Frame.Rank.Text = Ranks.Rank5.Name	
	elseif Donated.Value >= 1000 then 
		BillBoardClone.Frame.Rank.Text = Ranks.Rank6.Name	
	elseif Donated.Value >= 5000 then 
		BillBoardClone.Frame.Rank.Text = Ranks.Rank7.Name	
	elseif Donated.Value >= 10000 then 
		BillBoardClone.Frame.Rank.Text = Ranks.Rank8.Name
	elseif Donated.Value >= 20000 then
		BillBoardClone.Frame.Rank.Text = Ranks.Rank9.Name
	elseif Donated.Value >= 100000 then
		BillBoardClone.Frame.Rank.Text = Ranks.Rank10.Name
	end
end

local players = {}

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
		table.insert(players, plr.Name)
	end)
	plr.CharacterRemoving:Connect(function(char)
		players[plr.Name] = nil
	end)
end)

while task.wait() do
	for i, v in pairs(players) do
		if v == nil then continue end
		local char = game.Players[v].Character.Head.PlayerRank
		UpdateRank(game.Players[v], char, char.Head.PlayerRank)
	end
end

try this

i got an error at line 59:
Head is not a valid member of BillboardGui “Workspace.alirobloxerpro.Head.PlayerRank”

		UpdateRank(game.Players[v], char, char.Head.PlayerRank)

the file is
abc.rbxl (78.6 KB)

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 Donated = plr.leaderstats.Donated
	BillBoardClone.Frame.PlayerName.Text = plr.Name
	if Donated.Value == 0 then
		BillBoardClone.Frame.Rank.Text = Ranks.Rank1.Name
	elseif Donated.Value >= 25 then
		BillBoardClone.Frame.Rank.Text = Ranks.Rank2.Name
	elseif Donated.Value >= 50 then
		BillBoardClone.Frame.Rank.Text = Ranks.Rank3.Name
	elseif Donated.Value >= 200 then
		BillBoardClone.Frame.Rank.Text = Ranks.Rank4.Name
	elseif Donated.Value >= 500 then 
		BillBoardClone.Frame.Rank.Text = Ranks.Rank5.Name	
	elseif Donated.Value >= 1000 then 
		BillBoardClone.Frame.Rank.Text = Ranks.Rank6.Name	
	elseif Donated.Value >= 5000 then 
		BillBoardClone.Frame.Rank.Text = Ranks.Rank7.Name	
	elseif Donated.Value >= 10000 then 
		BillBoardClone.Frame.Rank.Text = Ranks.Rank8.Name
	elseif Donated.Value >= 20000 then
		BillBoardClone.Frame.Rank.Text = Ranks.Rank9.Name
	elseif Donated.Value >= 100000 then
		BillBoardClone.Frame.Rank.Text = Ranks.Rank10.Name
	end
end

local players = {}

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
		table.insert(players, plr.Name)
	end)
	plr.CharacterRemoving:Connect(function(char)
		players[plr.Name] = nil
	end)
end)

while task.wait() do
	for i, v in pairs(players) do
		if v == nil then continue end
		local char = game.Players[v].Character
		UpdateRank(game.Players[v], char, char.Head.PlayerRank)
	end
end

o my bad try this

Maybe, try this?

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 IsInRange(minimum: number, max: number)
	return math.clamp(minimum, max, game.Players:FindFirstChildOfClass("Player").leaderstats.Donated.Value)
end

local function UpdateRank(plr,char,BillBoardClone)
	BillBoardClone = game:GetService("ServerStorage")
	local Donated = plr.leaderstats.Donated
	local PlayerAmount = BillBoardClone.PlayerRank.Frame.PlayerAmount
	
	BillBoardClone.PlayerRank.Frame.PlayerName.Text = plr.Name
	if Donated.Value == IsInRange(0,24) then
		BillBoardClone.PlayerRank.Frame.Rank.Text = Ranks.Rank1.Name
	elseif Donated.Value >= IsInRange(25,49) then
		BillBoardClone.PlayerRank.Frame.Rank.Text = Ranks.Rank2.Name
	elseif Donated.Value >= IsInRange(50,199) then
		BillBoardClone.PlayerRank.Frame.Rank.Text = Ranks.Rank3.Name
	elseif Donated.Value >= IsInRange(200,499) then
		BillBoardClone.PlayerRank.Frame.Rank.Text = Ranks.Rank4.Name
	elseif Donated.Value >= IsInRange(500,999) then 
		BillBoardClone.PlayerRank.Frame.Rank.Text = Ranks.Rank5.Name	
	elseif Donated.Value >= IsInRange(1e3,5e3-1) then 
		BillBoardClone.PlayerRank.Frame.Rank.Text = Ranks.Rank6.Name	
	elseif Donated.Value >= IsInRange(5e3,1e4-1) then 
		BillBoardClone.PlayerRank.Frame.Rank.Text = Ranks.Rank7.Name	
	elseif Donated.Value >= IsInRange(1e4,2e4-1) then 
		BillBoardClone.PlayerRank.Frame.Rank.Text = Ranks.Rank8.Name
	elseif Donated.Value >= IsInRange(2e4,1e5-1) then
		BillBoardClone.PlayerRank.Frame.Rank.Text = Ranks.Rank9.Name
	elseif Donated.Value >= 100000 then
		BillBoardClone.PlayerRank.Frame.Rank.Text = Ranks.Rank10.Name
	end
end

task.wait(2.5) -- wait until the player has loaded

local players = {}

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
		table.insert(players, plr.Name)
	end)
	plr.CharacterRemoving:Connect(function(char)
		players[plr.Name] = nil
	end)
end)

while task.wait() do
	for i, v in pairs(players) do
		if v == nil then continue end
		local char = game.Players[v].Character.Head.PlayerRank
		UpdateRank(game.Players[v], char, char.Head.PlayerRank)
	end
end

nothing happened, like litterly nothing, no error, no gui, just nothing

the same problem when i first did the script

So, I want to say, that if there’s too much >=, the game gets confused and then only gets to the Rank2.

oh and guys my computer is so bad and its like 1002002 milisecond to load

and the amount donated dosent get updated

how do i fix that then???

HOOWWW

So, there’s a big problem, if you add a task.wait or anything that rhymes with wait, it’ll break, and, yeah…

Oh wait:

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
	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
	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}

It worked.

I EVEN MADE IT BETTER:

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 ABBREVIATIONS = {"K", "M", "B", "T", "Qa", "Qi", "Sx"}

	local function toHumanReadableNumber(num)
		if num < 1000 then
			return tostring(num)
		end

		local digits = math.floor(math.log10(num)) + 1
		local index = math.min(#ABBREVIATIONS, math.floor((digits - 1) / 3))
		local front = num / math.pow(10, index * 3)

		return string.format("%i%s+", front, ABBREVIATIONS[index])
	end
	BillBoardClone.Frame.PlayerAmount.Text = toHumanReadableNumber(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
	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}

Copy & paste the 2nd script.

it works but i have a problem,
i have 5M donation
when i get more donations, it dosent update, and if i reset charactor your leaderstat reset back to 5M

It’s because it’s abbreviating.

can you make it where its not abbreviating, and its dosent update

i dont want the leaderstats to reset back or people will start leaving my game

i dont want any problems with the leaderstat