I have a script I’ve been using for RP names / custom names displayed above players for about two years. However, I’ve noticed that while this seems to work for the vast majority of players, it does not work on all of them.
I originally thought it was an issue with users who have dynamic heads, but it works fine for some dynamic head users. When testing it on two avatars, it seemed to be fine for R6 but not for R15 when using dynamic heads. It could be coincidence though.
I’m wondering if maybe I missed something going defunct / depreciated, am not using the correct or up to date terms, or something like that. I’d appreciate any tips on how I could go about fixing this.
Attaching strictly my relevant code below. It seems to not even make it past “player.CharacterAdded:connect(function(char)”, as I tried putting print() past that point and none of them ever triggered when I changed myself to the avatars of two people who it doesn’t work for. It also doesn’t throw any errors or output at all in Studio.
game.Players.ChildAdded:connect(function(player)
local name = Instance.new("StringValue")
name.Name = "RPName"
name.Value = player.Name
name.Parent = player
--
player.CharacterAdded:connect(function(char)
char.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
local bill = Instance.new("BillboardGui", char:WaitForChild("Head"))
bill.Name = "name"
bill.Adornee = char:WaitForChild("Head")
bill.Size = UDim2.new(1,0,1,0,0,0)
bill.StudsOffset = Vector3.new(0,2.5,0)
bill.MaxDistance = 90
bill.AutoLocalize = true
bill.DistanceLowerLimit = 0
bill.DistanceUpperLimit = 20
local text = Instance.new("TextLabel")
text.Parent = bill
text.Text = (name.Value.." ["..player.Name.."]")
--
name.Changed:connect(function(newName)
text.Text = (newName.." ["..player.Name.."]")
end)
--
end)
end)
I have also tested HDAdmin’s " ;name " command on a definitely non-working avatar, and not even that works. The model it’s supposed to make inside of the player character is never made. If cross-examining my own code and HDAdmin’s similarly non-working code would help, this is what that looks like:
function module:CreateFakeName(plr, name)
local head = main:GetModule("cf"):GetHead(plr)
if head then
local fakeName = module:GetFakeName(plr)
if not fakeName then
fakeName = Instance.new("Model")
local fakeHead = head:Clone()
fakeHead.Name = "Head"
fakeHead.Parent = fakeName
fakeHead.face.Transparency = 1
local weld = Instance.new("WeldConstraint")
weld.Part0 = fakeHead
weld.Part1 = head
weld.Parent = fakeHead
local fakeHumanoid = Instance.new("Humanoid")
fakeHumanoid.Name = "FakeHumanoid"
fakeHumanoid.Parent = fakeName
fakeName.Parent = plr.Character
head.Transparency = 1
end
if name then
fakeName.Name = name
end
end
end
Again, would appreciate any help with or tips on solving this. It’s gotten incredibly annoying as of late.