Getting character from player

Hey developers!

I made a custom nametag, but I want to change the transparency for just the player that the nametag is from.

This is my current script, but it’s not changing the transparency, it’s changing the color.

--Variables--
local playername = game:GetService("Players").LocalPlayer.Name
local playercharacter = game.Workspace:WaitForChild(playername)
local nametext = playercharacter.Head.Nametag.NameText
local roletext = playercharacter.Head.Nametag.RoleText

--Script--
nametext.TextTransparency = 0.5
nametext.TextStrokeTransparency = 0.5
roletext.TextTransparency = 0.5
roletext.TextStrokeTransparency = 0.5

I tried using player.Character but it didn’t work for me.
Can anyone help me?

Have a nice day, iamajust

local Character = Player.Character or Player.CharacterAdded:wait()

Sorry for no format, mobile

Thanks! I will try this in a minute.

1 Like

Im getting the following error:

15:57:44.342 Head is not a valid member of Model “Parts.iamajust” - Client - NametagScript:3

Does this have anything to do with the head still loading?

Are you trying to get the head???

If so do;

Character:WaitForChild(“Head”)

1 Like

Yeah, the BillboardGUI is in the head. Thank you!

1 Like