How To Make BillboardGUI Text Label Invisible

Hello Fellow Scripters! Today I need help on making a text label in a BillboardGUI not visible. This script is in the serverscriptservice. My problem is that if your name == a Owner than the guest text label needs to be invisible but it’s not turning invisible. I have no errors (according to the Developer Console). Thanks!

My issue
image

My explorer

–// Varibles \–
local rep = game:GetService(“ReplicatedStorage”)
local nametag = rep.NameTag

–// Functions \–
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)

	--// Varibles \\--
	local head = char.Head
	local newtext = nametag:Clone() 
	local lowertext = newtext.LowerText
	local humanoid = char.Humanoid
	local guesttext = newtext.Guest
	humanoid.DisplayDistanceType = "None"

	--// Main Text \\--
	newtext.Parent = head
	newtext.Adornee = head
	
	
			
	--// Owner \\--
	if player.Name == "AmphibionplayzDev" then	
		lowertext.Text = "Owner"
		lowertext.TextColor3 = Color3.fromRGB(255, 51, 0)
		guesttext.Visible = false
	end

end)

When you’re comparing strings, it’s going to be case specific. This means that you have to capitalize the letter P in “Playz” when you’re comparing your player’s Name.

However, I would advise using UserId instead as that can never change for each player.

I would like to add on that he should be checking his UserId instead of Name in case he ever changes it.

2 Likes

i will try that i changed the code but i didn’t work

	--// Varibles \\--
	local head = char.Head
	local newtext = nametag:Clone() 
	local uppertext = newtext.UpperText
	local lowertext = newtext.LowerText
	local humanoid = char.Humanoid
	local guesttext = newtext.Guest
	humanoid.DisplayDistanceType = "None"

	--// Main Text \\--`
	newtext.Parent = head
	newtext.Adornee = head
	--// Changes To Player's Name \\--
	uppertext.Text = player.Name
			
	--// Owner \\--
	if player.UserId == "2453219029" then	
		lowertext.Text = "Owner"
		lowertext.TextColor3 = Color3.fromRGB(255, 51, 0)
		--// Color Of Rank \\--
		guesttext.Visible = false
	end

You don’t need to turn the number into a string since the UserId property is already a number.

Don’t put it in strings. if player.UserId == 2453219029 then

so then I should keep it player.Name like it was then put my id

You wouldn’t reference the player’s Name at all since the player’s Name is completely separate from their UserId.

Checking for UserId is better practice since that’s an indentifying factor of a player that will never change.

You can simply adjust this:

if player.UserId == "2453219029" then

To be this:

if player.UserId == 2453219029 then

More info about the UserId property can be found on this Developer Hub Page.

2 Likes

that makes sense but all it did was make all the GUIs invisible!
so it’s half working

–// Functions \–
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)

	--// Varibles \\--
	local head = char.Head
	local newtext = nametag:Clone() 
	local uppertext = newtext.UpperText
	local lowertext = newtext.LowerText
	local humanoid = char.Humanoid
	local guesttext = newtext.Guest
	humanoid.DisplayDistanceType = "None"

	--// Main Text \\--
	newtext.Parent = head
	newtext.Adornee = head
	--// Changes To Player's Name \\--
	uppertext.Text = player.Name 
			
	--// Owner \\--
	if player.UserId == 1260127860 then	
		lowertext.Text = "Owner"
		lowertext.TextColor3 = Color3.fromRGB(255, 51, 0)
		--// Color Of Rank \\--
		guesttext.Visible = false
	end

Try this, should fix it:

--// Varibles \\--
	local head = char.Head
	local newtext = nametag:Clone() 
	local uppertext = newtext.UpperText
	local lowertext = newtext.LowerText
	local humanoid = char.Humanoid
	local guesttext = newtext.Guest
	humanoid.DisplayDistanceType = "None"

	--// Main Text \\--`
	newtext.Parent = head
	newtext.Adornee = head
	--// Changes To Player's Name \\--
	uppertext.Text = player.Name
			
	--// Owner \\--
	if player.UserId == 2453219029 then	
		lowertext.Text = "Owner"
		lowertext.TextColor3 = Color3.fromRGB(255, 51, 0)
		--// Color Of Rank \\--
		guesttext.Visible = false
	end
1 Like

You’re not using the right UserId – the UserId on your profile is 2453219029/the same one you mentioned in this post

Edit: Nevermind @GoteeSign is correct – the UserId is referencing his other account that is currently in Studio

1 Like

Maybe a main account

1 Like

i am going to add in some print statements to see if anything is blocking the script

1 Like

I’m not sure what would be causing the other text to disappear unless there’s more code below what was shown that could be modifying the other GuiObjects – the condition that would be met is only changing the visibility of the guesttext, which shouldn’t impact the other text.

In case it wasn’t set by default, you can reference the other text objects and ensure that their Visible property is set to true.

Did you define player in your script?

Hi Guys, so i figured out the issue somehow an extra 0 got added to the end of the id but since @ StrongBigeMan9 helped me with the strings it would’ve worked!

1 Like