I have a name tag script for everyone, owner, and coowner, but i’m showing the owner to fix and then i’ll edit the others. Basically the name tag script works, but if you die or reset for some reason your character spawns in as the default and with grey skin
local name = plr.Name
local playerinplayers = game.Players:FindFirstChild(plr.Name)
if playerinplayers ~= nil then
playerinplayers.CanLoadCharacterAppearance = false
plr.Humanoid.DisplayDistanceType = "None"
if name ~= "5O50s" then --Put Your Name Here
game.Lighting.NameTag.Text.Text = name
game.Lighting.NameTag:Clone().Parent = plr.Head else
game.Lighting.NameTag.Text.TextStrokeTransparency = 0
game.Lighting.NameTag.Text.Text = name
game.Lighting.Owner.Text3.Visible = true
game.Lighting.Owner:Clone().Parent = plr.Head
game.Lighting.NameTag:Clone().Parent = plr.Head
end
end
end)
Idk what’s causing it bc i’m still fairly new to scripting and I’m unable to figure a lot for my own
Is this the entire script? It looks like you cut something out at the top.
I’m assuming this is in a PlayerAdded function, which means the code will only run on join. You will need to add the name tag on every CharacterAdded because the name tag will be destroyed upon respawn.
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
-- add name tag
end)
end)
game.Workspace.ChildAdded:connect(function(plr)
local name = plr.Name
local playerinplayers = game.Players:FindFirstChild(plr.Name)
if playerinplayers ~= nil then
playerinplayers.CanLoadCharacterAppearance = false
plr.Humanoid.DisplayDistanceType = "None"
if name ~= "5O50s" then --Put Your Name Here
game.Lighting.NameTag.Text.Text = name
game.Lighting.NameTag:Clone().Parent = plr.Head else
game.Lighting.NameTag.Text.TextStrokeTransparency = 0
game.Lighting.NameTag.Text.Text = name
game.Lighting.Owner.Text3.Visible = true
game.Lighting.Owner:Clone().Parent = plr.Head
game.Lighting.NameTag:Clone().Parent = plr.Head
end
end
end)
Yeah, the problem is your adding the name tag when the player joins, so it will only show until they respawn. You also shouldn’t use Workspace.ChildAdded to detect when players join, because game.Players.PlayerAdded is much easier to use and is designed specifically for that purpose.
You should add the nametag inside of a Player.CharacterAdded listener, as I wrote in my previous post.
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
-- add name tag
end)
end)
now the output is saying “Humanoid is not a valid member of Player”. And the nametag completely stopped working
player.CharacterAdded:Connect(function(character)
local name = player.Name
local playerinplayers = game.Players:FindFirstChild(player.Name)
if playerinplayers ~= nil then
playerinplayers.CanLoadCharacterAppearance = false
player.Humanoid.DisplayDistanceType = "None"
if name ~= "5O50s" then
game.Lighting.NameTag.Text.Text = name
game.Lighting.NameTag:Clone().Parent = player.Head else
game.Lighting.NameTag.Text.TextStrokeTransparency = 0
game.Lighting.NameTag.Text.Text = name
game.Lighting.Owner.Text3.Visible = true
game.Lighting.Owner:Clone().Parent = player.Head
game.Lighting.NameTag:Clone().Parent = player.Head
end
end
end)
end)
i did that and it doesn’t work AND the characters are grey again
player.CharacterAdded:Connect(function(character)
local name = player.Name
local playerinplayers = game.Players:FindFirstChild(player.Name)
if playerinplayers ~= nil then
playerinplayers.CanLoadCharacterAppearance = false
character.Humanoid.DisplayDistanceType = "None"
if name ~= "5O50s" then
game.Lighting.NameTag.Text.Text = name
game.Lighting.NameTag:Clone().Parent = player.Head else
game.Lighting.NameTag.Text.TextStrokeTransparency = 0
game.Lighting.NameTag.Text.Text = name
game.Lighting.Owner.Text3.Visible = true
game.Lighting.Owner:Clone().Parent = player.Head
game.Lighting.NameTag:Clone().Parent = player.Head
end
end
end)
end)
What do you mean it doesn’t work, can you show us your output dialog so we can see the errors? also I don’t entirely understand why you want to do this playerinplayers.CanLoadCharacterAppearance = false, If you are referring to players going grey then this is because you have added this line of code which will prevent their avatar from loading in. VIA grey skin with no cosmetics
I would suggest CharacterAppearanceLoaded on this one. This way it’ll load the name tag after the character is loaded. This helps because every asset the character needs is loaded. CharacterAdded in certain cases may not load the name tag at all sometimes. So I suggest using this over CharacterAdded instead and remove
this line is kind of obvious, as it states doesn’t load the character appearance. This is not something I’d use unless giving a custom character appearance personally.