The Premium players Chat tag does not show up

I wrote this script and the chat tag in for my premium friend did not show up
i did not take a screen coz my laptop shutdown
there are no errors in the output
here is my full code:

local Players = game:GetService("Players")
game.Players.PlayerAdded:Connect(function(player)
 player.CharacterAdded:Connect(function()
if player.MembershipType == Enum.MembershipType.Premium then
	local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")
    
		local clonedgui = billboardgui:Clone()
		clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
		clonedgui.TextLabel.Text = "Premium"
		clonedgui.TextLabel.TextColor3 = Color3.fromRGB(192,192,192)
		
		local ServerScriptService = game:GetService("ServerScriptService")
	local ChatService = require(ServerScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
	local Players = game:GetService("Players")
	local Premium = clonedgui
	
	ChatService.SpeakerAdded:Connect(function(PlrName)
		local Speaker = ChatService:GetSpeaker(PlrName)
		for _, v in pairs(Premium) do
			if Players[PlrName].Name == v then
				Speaker:SetExtraData('Tags', {{TagText = "Premium", TagColor = Color3.fromRGB(255, 255, 255)}})
			end
		end
	end)
end
end)
end)
2 Likes

Have you added any print statements for debugging purposes? I would put one after the PlayerAdded connection that prints the players name to ensure that there isn’t anything in your code that’s yielding and preventing further connections from being created along with after your if statements. Also, a few things.

You can change

clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head

To

clonedgui.Parent = player.Character:FindFirstChild("Head")

You already have a characteradded event, so there’s no point in using WaitForChild() to find the character in workspace.

There also isn’t a point in using :WaitForChild() twice. If you’ve already utilized it for yielding until ChatServiceRunner exists, there would be no need to check if ChatService, a descendant of ChatServiceRunner exists.

Ok let me try it cause ima bout to release my video

It does not show the chat tag my friend joined but it
does not show the premium chat tag

Did it show it before you made that change?

no sir he chatted saying “hey the premium chat tag does not still work lol”

First of all, you can’t use:

As you haven’t assigned a variable to the character and haven’t added a yield if the character has not been found.

Instead add the “char” parameter to:

and then you can add:

clonedgui.Parent = char:FindFirstChild("Head")

-------------------‐------------------

Also, it would be useful if you could show us your output so that it can be more easier.

1 Like

there are no errors and onlly my plugin

Again, try adding print statements after your connection with PlayerAdded and the if statement checking the membership type. See if it’s able to print the player’s name. If not, it could be an issue with something else in your code yielding and preventing the connection. Is this in a script by itself?

It worked! thank you so much i will add print statements now