My Roblox Premium Player Chat tag does not work

I want to make a premium player chat tag but we i joined the game it does not work
P.S I have premium

 local serverScriptService = game:GetService("ServerScriptService")
	    local chatService = require(serverScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
	    local players = game:GetService("Players")
	    local Premium =  game.Workspace:WaitForChild(player.Name).Head
	   
         --Chat Settings
	    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, 127)}})
			end
		end
	end)
1 Like

can you provide an image of the output?

since you’re looping through a table, shouldn’t you write:

for i, v in pairs(Premium:GetChildren()) do

?

i removed it and theres a error
the end) in the ended line is red
image

Don’t you need to check if the player has Premium?

if player.MembershipType == Enum.MembershipType.Premium then
-- Code here
 local serverScriptService = game:GetService("ServerScriptService")
	    local chatService = require(serverScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
	    local players = game:GetService("Players")
	    local Premium =  game.Workspace:WaitForChild(player.Name).Head
	   
         --Chat Settings
	    chatService.SpeakerAdded:Connect(function(PlrName)
		local Speaker = chatService:GetSpeaker(PlrName)
		for i, v in pairs(Premium:GetChildren()) do
			if Players[PlrName].Name == v then
				Speaker:SetExtraData('Tags', {{TagText = "Premium", TagColor = Color3.fromRGB(255, 255, 127)}})
			end
		end
	end)

if @dibblydubblydoo solution added it should be this

I did it

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(231,206,12)-- Pick a fromRBG or Color3

         local serverScriptService = game:GetService("ServerScriptService")
	    local chatService = require(serverScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
	    local players = game:GetService("Players")
	    local Premium =  {'RedDevED'}
	   
         --Chat Settings
	    chatService.SpeakerAdded:Connect(function(PlrName)
		local Speaker = chatService:GetSpeaker(PlrName)
			if Players[PlrName].Name == v then
				Speaker:SetExtraData('Tags', {{TagText = "Premium", TagColor = Color3.fromRGB(255, 255, 127)}})
			end
		end)
	end
end
end)
end)
1 Like