So I'm trying to add a name & role tag on top of a player's head by using the billboard gui. Inside the gui there are two text labels, one named 'Name' and the other named 'Role'. I stored the billboard gui inside the server storage and this is how I wrote my script:

local BillboardGui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")


game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		
		local UserTag = BillboardGui:Clone()  -- To clone the billboard gui
		
		local humanoid = char.Humanoid      -- To disable the default player tag    
		humanoid.DisplayDistanceType = "None"  
	
		UserTag.Parent = char.Head  -- To set the parent to the player's head
		UserTag.Adornee = char.Head

		UserTag.Name.Text = player.Name -- To change the name & roles
		UserTag.Role.Text = "Test"
		
		
	end)
end)

The cloned gui worked out fine and appeared on top of my head when I tested playing it but the problem is the text of both of the text labels did not change and remained the same. I got an error from the output saying:

23:32:28.136 - ServerScriptService.OverheadGUI script:15: attempt to index string with 'Text'

I asked help from a friend and he basically replicated my script and it worked for him. So I'm wondering if the problem lies in the script or perhaps in the gui/textlabel itself? Any help is appreciated.

2 comments

0

You're going to have to rename the 'Name' TextLabel. Name is already a property of the UserTag so it fails to reference the TextLabel.

0

Oh, I didn't even thought about that. Everything works fine now, thanks!