How would I go about adding a chat tag if they purchase the gamepass ingame?

The way my game checks if the player is VIP (for example), is creating a value inside a folder called “Gamepasses” on the player if they own the gamepass. If they join after they have purchased the gamepass, the chat tag does work, however if they purchase the gamepass ingame, they have to rejoin in order to have their tags be added.

When the player purchases a gamepass ingame, it also does create the value inside that folder.

This is the code:

local ServerScriptService = game:GetService("ServerScriptService")
local ChatService = require(ServerScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
local MarketPlaceService = game:GetService("MarketplaceService")

	local Speaker = ChatService:GetSpeaker(PlrName)
	local player = Speaker:GetPlayer()
	local folder = player:WaitForChild("Gamepasses")
	local VIP = folder:FindFirstChild("VIP")
	if VIP then
		Speaker:SetExtraData("Tags", {{
		TagText = "VIP",
		TagColor = Color3.fromRGB(255, 255, 255)

From what I read, SpeakerAdded only runs when the player first joins.
How would I go around this, so they get their chat tag added if they purchase the gamepass ingame?

You don’t need to connect to the SpeakerAdded event. You can just use :GetSpeaker(PlayerName) to find the speaker, and then edit it from there.

(Sorry if there’s irrelevant code here, I just snagged it from my game).

1 Like

That worked! Thank you so much!