How do i make vip chat tags?

Hi, i was working on my data script for my game and i wanted to add vip chat tags, so my first solution was to use chatservice (not the service one), but i didnt know to use it, so i searched and found a post about it, so problem solved right? no, the reason why is because the script was using the PlayerAdded event, meaning, if a player purchased the vip gamepass in-game, they have to rejoin, and recieve the effects of the gamepass.

to resume for you guys (that are maybe confused), how do i make a vip chat tag that when a player purchases the gamepass, he immediately get the effects?

if you know how to, let me know!

1 Like

First, check if they have the VIP gamepass using MarketplaceService:UserOwnsGamePassAsync.
Do this check when they send a mesage in chat. If they pass the check, add the VIP tag. if they don’t, proceed as normal…
Unless I’ve misunderstood the question…?

I hope this work

local yourgamepassid = 0 --change this to gamepass your id
local Players = game:GetService("Players")
local MarketPlaceService = game:GetService("MarketplaceService")
local BadgeService = game:GetService("BadgeService")
local Owner = {game.Players:GetNameFromUserIdAsync(game.CreatorId)}

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

ChatService.SpeakerAdded:Connect(function(PlrName)
	local Speaker = ChatService:GetSpeaker(PlrName)
	for _, v in pairs(Owner) do
		while wait(1) do --Loop the script to check if player owns gamepass
		Speaker:SetExtraData('Tags', {{TagText = "Guest", TagColor = Color3.fromRGB(32, 240, 0)}}) -- When player added set this as chat tag

		if MarketPlaceService:UserOwnsGamePassAsync(Players[PlrName].UserId,yourgamepassid) then
			Speaker:SetExtraData('Tags', {{TagText = "Vip", TagColor = Color3.fromRGB(32, 240, 0)}}) -- When player has gamepass they get vip
			end
			
			end
	
	end
end) 

use this if you want to remove the chat tags

Speaker:SetExtraData("Tags")