What is the error in this?

Thank you xmthl. :)))) see you

Change the char.Humanoid to char:WaitForChild("Humanoid")

unfortunately it didn’t happen

What is the motive of this script like, what does it suppose to do?

The only thing that I managed to find wrong with the code is when you do:

humanoid.DisplayDistanceType = "None"

DisplayDistanceType is an Enum and not a string.

https://developer.roblox.com/en-us/api-reference/property/Humanoid/DisplayDistanceType

So instead of setting it to “None”, set it to the enum like so:

humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None

The other changes I’ve made are :WaitForChild() checks, which will wait until the script is certain that the object you’re looking for exists. There is a second parameter for a timeout in :WaitForChild() like:

object:WaitForChild("...", 2)

Which will wait 2 seconds before it just skips over the code if it doesn’t find “…” in this case.

Try this code, it should work but if it doesn’t, let me know and tell me if there’s any errors in the output console.

local rep = game:GetService("ReplicatedStorage")
local plrs = game:GetService("Players")

local nametag = rep:WaitForChild("NameTag")

plrs.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		local deneme = player:GetRoleInGroup(3529061)
		
		local head = char:WaitForChild("Head")
		local humanoid = char:WaitForChild("Humanoid")
		
		local newtext = nametag:Clone()
		local uppertext = newtext:WaitForChild("UpperText")
		local lowertext = newtext:WaitForChild("LowerText")

		print(deneme)

		humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None

		newtext.Parent = head
		newtext.Adornee = head
		uppertext.Text = player.Name

		if player:IsInGroup(3529061) and player.TeamColor == BrickColor.new("Maroon") then
			lowertext.Text = "Deneme" .. " | " .. deneme
			lowertext.TextColor3 = Color3.fromRGB(145, 145, 145)
		end
	end)
end)

If you have any questions, let me know! :smiley:

1 Like