I am making a special chat tag for when someone purchases a gamepass using SetExtraData, however, since I am executing the SpeakerAdded event when the server is created, the player would still need to rejoin the game to get this tag.
I have tried several things, such as disconnecting the event when the gamepass is purchased and firing the event again afterwards however it did not work. I have also tried caching data but it did not work either; specifically because this code runs when the server is created.
(I am aware of gamepasses having a delayed caching time and I have my own caching module for it)
Instead of using SpeakerAdded (You want it for when they rejoin, so use it in a script of course) use something like this:
--Fire this in the script where the player bought the gamepass
RemoteEvent.OnServerEvent:Connect(function(Player)
local Players = game:GetService('Players')
local ServerScriptService = game:GetService('ServerScriptService')
local ChatService =
require(ServerScriptService:WaitForChild('ChatServiceRunner'):WaitForChild('ChatService'))
local Speaker = ChatService:GetSpeaker(Player)
Speaker:SetExtraData('NameColor', Color3.fromRGB(255, 255, 255))
Speaker:SetExtraData('ChatColor', Color3.fromRGB(255, 255, 255))
Speaker:SetExtraData('Tags', {{TagText = 'VIP', TagColor = Color3.fromRGB(255, 255, 255)}})
end)