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)
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 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.
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?