Overhead gui not appearing

hi, today i was trying to learn billboard gui. But i have a problem. It is not appearing.

My code:

game.Players.PlayerAdded:Connect(function(player) 
	player.CharacterAdded:Connect(function(character) 
		local share= game.ReplicatedStorage:WaitForChild("Shared")
		local naems = share:WaitForChild("Naem")
		local currentclass = player.EquippedCl.Value
		local gui = naems:WaitForChild(currentclass)
		gui.Parent = character.Head
		gui.Adornee = character.Head 
		gui.playername.Text = gui.Name
	end)
end)

Try to offset the billboard gui to be above the player.

Go to the Gui->StudsOffset and change it to 0,1.5,0

you just put the value(currentclass) in player head

No, that is the billboard gui’s name. I made the classes name to be the exact same as billboard gui’s name but it is in a different folder

Try changing “naems:WaitForChild(currenctclass)” to ‘naems:WaitForChild(tostring(currentclass))’.

It is a string value tho. So it didnt change

Edit: tried it, didn’t work

Oh. I couldn’t tell. Maybe try:

game.Players.PlayerAdded:Connect(function(player) 
	player.CharacterAdded:Connect(function(character) 
	player.CharacterAppearanceLoaded:Connect(function()
		local share= game.ReplicatedStorage:WaitForChild("Shared")
		local naems = share:WaitForChild("Naem")
		local currentclass = player.EquippedCl.Value
		local gui = naems:WaitForChild(currentclass)
		gui.Parent = character.Head
		gui.Adornee = character.Head 
		gui.playername.Text = gui.Name
	      end)
	end)
end)

Just wanted to quickly confirm here, you’re getting no infinite yield warnings in the output, as well as no errors correct? Have you attempted to add a print statement at the bottom of your code to ensure it’s running fully? I’m unsure if this is the full script - so I thought it’d be useful to ask.

Edit: Looking more into the code here I’m almost 100% positive the issue here is that your character is loading in too fast. The above method should work for you.

The problem might be that you’re trying to do this before the player is even loaded into the game. There is an abundance of ways this could go in a different direction than hoped for.

try change it to

local gui = naems:FindFirstChild(currentclass)

Yes im getting, but no errors it is not printing.The above script isnt working.

The above script isnt working

This text will be blurred

So, you are getting infinite yield warnings? This may imply that the item doesn’t exist (or it’s just taking awhile to load in, which will stop anything below that :WaitForChild from running). Can you send the infinite yield possible warnings you’re getting?

Infinite yield possible on ‘ReplicatedStorage.Shared.Naem:WaitForChild("")’

Is this in your current script you’ve showcased here? Would you mind showing me the line where this is happening?

the 7th line.

	local gui = naems:WaitForChild(currentclass)

Ah, wonderful. I believe we have our issue then. From the looks of your inf yield message, it appears that currentclass seems to be an empty string. It appears that local currentclass = player.EquippedCl.Value, but under the assumption this is a StringValue, it’s not actually changing anything. Do you have code which changes that value to something else? If so, could you give me the information regarding it such as:

  • Is it a LocalScript or ServerScript?
  • What does the code look like?

It is a module script but is activated by a server script.
it looks like:

if player.leaderstats.Coins.Value >= tonumber(price)  then
					print("A")
					local stval = Instance.new("StringValue")
					stval.Name = classname
					stval.Parent = player.Ownedcl
					player.EquippedCl.Value = classname
				
					player.Multi.Value = classfound.Multiplier.Value
					player.leaderstats.Strength.Value = 0
					
					player.leaderstats.Coins.Value = 0

Server script:

local buycl = game.ReplicatedStorage.Remotes.buycl -- wherever the remote event is

buycl.OnServerInvoke = function(player, classname, status)
	local something = remotecon.buycl(player,classname, status)
	return something
end

For whatever reason it doesn’t look like it’s doing that unfortunately. Just to confirm this is the only issue, you could do some debugging and set currentClass to something that is there. If it works from there, this would be the only issue.