Bug with adding VIP chat tag

Hello!!

I encountered an error while integrating the VIP tag into my chat tag system using ChatGPT. Could you please help me resolve this issue or provide guidance on how to fix it?


What happened in the chat?

chat


What it should look like

Tag Name Text
God Roblox: Staff Tag
Vip Roblox: Vip Tag
Roblox: No Tag

The script



-- Thank you too @Katrist for Writing the script

--script.Parent = game.StarterPlayer.StarterPlayerScripts

local Players = game:GetService("Players")
local TextChatService = game:GetService("TextChatService")
local MarketplaceService = game:GetService("MarketplaceService")

local groupId = 9508756 -- # Out Just Because
local vipGamePassId = 103349116 -- VIP Game Pass ID

local tags = {
	[255] = "<font color='#F5CD30'>[⚡God]</font><font color='#ff40ff'> ",
	[254] = "<font color='#ff2600'>[🔨Developer]</font><font color='#2b83ff'> ",
	[253] = "<font color='#ff2600'>[🔨Developer]</font><font color='#2b83ff'> ",
	[214] = "<font color='#9c1df0'>[🛠️President]</font><font color='#b3b6b7'> ",
	[212] = "<font color='#9c1df0'>[🛠️Head of Staff]</font><font color='#b3b6b7'> ",
	[203] = "<font color='#2af0be'>[🌴Community manager]</font><font color='#2af0be'> ",
	[202] = "<font color='#9b1df0'>[🛠️Admin]</font><font color='#b3b6b7'> ",
	[200] = "<font color='#e1a9f5'>[🔧Moderator]</font><font color='#b3b6b7'> ",
	[111] = "<font color='#83feec'>[🛠️Affiliate]</font><font color='#b3b6b7'> ",
	[110] = "<font color='#ff8b07'>[🔥Partner]</font><font color='#ffd607'> ",
	[101] = "<font color='#F5CD30'>[⭐️Supporter]</font><font color='#b3b6b7'> ",
	[100] = "<font color='#63e848'>[✨Vip Dog]</font><font color='#b3b6b7'> ",
}

TextChatService.OnIncomingMessage = function(message: TextChatMessage)
	local props = Instance.new("TextChatMessageProperties")

	if message.TextSource then
		local player = Players:GetPlayerByUserId(message.TextSource.UserId)

		if player then
			-- Check if the player has a rank tag
			local rank = player:GetRankInGroup(groupId)
			local prefixTag = tags[rank] or nil

			-- If no rank tag is found, check for VIP game pass ownership and add color for VIP
			if not prefixTag then
				local ownsVIP = MarketplaceService:UserOwnsGamePassAsync(player.UserId, vipGamePassId)
				if ownsVIP then
					prefixTag = "<font color='#FFD700'>[💎VIP]</font><font color='#FFD700'> "
				end
			end

			-- Apply the prefix tag if available
			props.PrefixText = (prefixTag or "") .. (message.PrefixText or "")
		end
	end

	return props
end


Thank you