BillboardGui disabled, yet still visible?

Can see in the SS that it’s been disabled, yet I can see it still visible (at the top of the screen)

Note, I disable it from the client:

local function SetNameTag(active)
	local Character = Player.Character
	if not Character then return end

	Character.Head.NameTag.Enabled = active
end

print(1)
SetNameTag(false)

And the prints all print

As I can see in the output, print('Disabling') isn’t printing Disabling, probably because the Character didn’t load yet, and thus the if not Character then return end just returned and the function stopped without disabling the UI.

To avoid this problem simlply add a small wait before calling the function. It does make sense to use player.CharacterAdded:Wait(), but really this problem here will only happen if the function is called before the character was loaded, which I doubt will happen when an actual player plays the game, so it’s just for testing purposes.

local function SetNameTag(active)
	local Character = Player.Character
	if not Character then return end
	print('Disabling')
	Character.Head.NameTag.Enabled = active
end

wait(2)
SetNameTag(false)

Sorry, I added the print(‘Disabling’) after the ss and rested. Same problem tho

1 Like

If you are trying to hide the BillboardGui for the local player, then i advice using the PlayersToHideFrom property of the BillboardGui

1 Like

That’s a pretty simple fix, you can change the text of the textlabel to nothing instead so it doesn’t display.

Example:

    local Character = Player.Character;
    if not Character then return end;
    if active then
        Character.Head.NameTag.Textlabel.Text = "Leader";
    else
        Character.Head.NameTag.Textlabel.Text = "";
    end;
end;
3 Likes

That’s not an optimal solution

2 Likes

I’m sorry, I wasn’t thinking straight. Here’s a solution that is optimal.

SOLUTION:

local function setNameTag(active)
      local Character = Player.Character;
      if Character then return end;
      print("Disabling!")
      Character.Head.NameTag.TextLabel.Visible = active;
end;
1 Like

Still visible

I shouldn’t need to make the labels invisible. Enabled should disable the UI

Try to do it from the serverside and not the client

I don’t really wanna have to hook up a remote event just for this one person.

Small note, but on the first attempt it doesn’t work, but subsequent tries it does work, so I don’t know why it won’t work on the first try

1 Like

This looks like the script would fire when a player just joined the game, so maybe its because the character wasn’t fully loaded in yet(local scripts tend to not find the character when a player joins the game).

So I would change it:

local function SetNameTag(active)
	local Character = Player.Character
	if not Character then Character = Player.CharacterAdded:Wait() -- waits until the character is added
	print('Disabling')
	Character.Head.NameTag.Enabled = active
end

print(1)
SetNameTag(false)

The character has loaded tho? If ‘Disabling’ is printing then the character has already loaded

1 Like

In the most recent image

You can see that the enabled is still “true”. My only guess at this point is “ResetOnSpawn” is equal to true. Try ticking that to false and see what happens.

1 Like

That was because I tried the PlayersToHideFrom which didn’t work either

Does it fail on the live game and Test Server too? Or just Play Solo?

Do not try to do sorts of “active” and “unactive”.

I’ve fixed your code now. There is the code:

local function SetNameTag(active)
	local Character = Player.Character
	if not Character then return end
	print('Disabling')
	Character.Head.NameTag.Enabled = true
end

print(1)
SetNameTag(false)

No :man_facepalming: there’s a reason why I use active. Because I use this functions again to re-enable the tag…

1 Like

This seems very much like a bug. I can’t reproduce it in a blank baseplate with the exact same properties on the BillboardGui. Try it in a live game. Try it in Test Server. If it continues with those, then something very very strange is going on.

If this Gui exists on the server, try having it disabled on the server and enabled on each client to see if it’s any different. Either way this is a bug. Enabled should have executive control over whether the Gui renders or not.

1 Like

Ye still occurs in game as well :confused:

1 Like