Coding help (Nametag Customization)

Heya so I’d like to have certain users have certain nametags such as “owner” or other names.

How would I do that with this code? I really cant figure out how.

	main = 8083234 -- Your GroupID Here!
}

script.Parent.Parent = game:GetService("ServerScriptService")

local sr = script:GetAttribute("disabled")

local players = game:GetService('Players')
local Gui = script.GroupRank

players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		char.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
		
		local Clone1 = Gui:Clone()
		Clone1.Namey.Text = player.Name
		if script:GetAttribute("disabled") then
			Clone1.Rank.Text = "READ THE README AND ENABLE HTTPSERVICE"
		else
			Clone1.Rank.Text = player:GetRoleInGroup(groups.main)
		end
		delay(.1,function()
			Clone1.Parent = char:WaitForChild("Head")
		end)
	end)
end)```

i tried local player.name and then “rank.text” but that didnt work.

try adding wait for child for humanoid root part or head or something like that

1 Like

how would I do that? Stuck and scratching my head lol

the caracter added event runs too early so sometimes the character don’t load completly

so is it a code issue? im stuck? How would I code that to be able to customize it??

try using the CharacterAppearanceLoaded instead of CharacterAdded

if player.name == “Vephinox” then

Namey.Text == player.Name

Rank.Text == “Lead Developer”

end

players.PlayerAdded:Connect(function(player)
player.CharacterAppearanceLoaded:Connect(function(char)
char.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None

	local Clone1 = Gui:Clone()
	Clone1.Namey.Text = player.Name
	if script:GetAttribute("disabled") then
		Clone1.Rank.Text = "READ THE README AND ENABLE HTTPSERVICE"
	else
		Clone1.Rank.Text = player:GetRoleInGroup(groups.main)
	end
	delay(.1,function()
		Clone1.Parent = char:WaitForChild("Head")
	end)
end)

end)

if player.name == “Vephinox” then
Namey.Text == player.Name
Rank.Text == “Lead Developer”
end

still giving me an error.
???

so maybe is in the if statement code line, do instead if script:GetAttribute(“disabled”) == true

because the script can interpratate as if you are checking if the attribute exists

Pretty sure this is supposed to be;

task.delay(.1, function()
end)

i dont think so, the task.delay is more optmized but the delay func still works so…

This could be your error, you are attempting to parent a service to another service. You can’t change this. Unless you have this elsewhere.

local main_group = 8083234
local players = game:GetService('Players')
local Gui = script.GroupRank

players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		char.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
		char.Humanoid.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff

		local Clone1 = Gui:Clone()
		Clone1.Namey.Text = player.Name
		Clone1.Rank.Text = player:GetRoleInGroup(main_group)
		
		task.delay(.1,function()
			Clone1.Parent = char:WaitForChild("Head")
		end)
		
	end)
end)

Here’s the working script I have right now,

image

local groups = {
main = 8083234 – Your GroupID Here!
}

– Template: [UserId] = “Name”;
local overrideGroupRolePlayers = {
[00000000000] = “Lead Developer”;
}

script.Parent.Parent = game:GetService(“ServerScriptService”)

local sr = script:GetAttribute(“disabled”)

local players = game:GetService(‘Players’)
local Gui = script.GroupRank

players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
char.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None

    local Clone1 = Gui:Clone()
    Clone1.Namey.Text = player.Name
    if script:GetAttribute("disabled") then
        Clone1.Rank.Text = "READ THE README AND ENABLE HTTPSERVICE"
    elseif overrideGroupRolePlayers[player.UserId] then
         Clone1.Rank.Text = overrideGroupRolePlayers[player.UserId]
    else
        local GroupRole = player:GetRoleInGroup(groups.main)
        Clone1.Rank.Text = GroupRole
    end
    delay(.1,function()
        Clone1.Parent = char:WaitForChild("Head")
    end)
end)

end)

I fixed it myself thanks foethe help!!