TextChatService Inconsistent results when trying to edit the message properties

  1. What do I want to achieve?
    A thing that lets players use the name that appears on their in-game tag as the name that appears in chat.

  2. What is the issue?
    It works about 5% of the time. I have no idea what’s causing this. Sometimes it works, but other times (most of the time) it doesn’t.
    And I know for a fact it can’t be my variables cause the function itself just decides not to fire sometimes. By the way I mean when I playtest it might work or not. If i exit playtest and try again, it might work or might not.

  3. What solutions have I tried so far?
    Looking on the dev forum for people with similar issues, no luck.
    Removing the for _ loop thinking it was cause there was too much delay in returning the properties and sending the message in chat
    Using message.status (not what I’m looking for).
    A multitude of things that all didn’t seem to change a thing.

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

TextChatService.OnIncomingMessage = function(message)
	print("Message!")
	if message.TextSource then
		if message.Status == Enum.TextChatMessageStatus.Success then
			local Plr:Player = Players:GetPlayerByUserId(message.TextSource.UserId)
			print(Plr, "MESSAGED")
			if Plr:FindFirstChild("UseNameTagForChat") then
				local Character = Plr.Character
				local Torso:Part = Character:FindFirstChild("Torso")
				local NameTag = nil
				for _, Tag in ipairs(Torso:GetChildren()) do
					if Tag:IsA("SurfaceGui") and Tag:FindFirstChild("IsNameTag") then
						NameTag = Tag
						break
					end
				end
				local TagName = NameTag.Content:FindFirstChild("Name").Text
				if Players:FindFirstChild(TagName) then
					local TaggedPlayer:Player = Players:FindFirstChild(TagName)
					local DisplayName = TaggedPlayer.DisplayName
					local TextColorHEX = Torso.Color:ToHex()
					print(TextColorHEX)
					local properties = Instance.new("TextChatMessageProperties")
					properties.PrefixText = '<font color = "#'..TextColorHEX..'">'..DisplayName..':</font>'
					return properties
				else
					local TextColorHEX = Torso.Color:ToHex()
					print(TextColorHEX)
					local properties = Instance.new("TextChatMessageProperties")
					properties.PrefixText = '<font color = "#'..TextColorHEX..'">'..TagName..':</font>'
					return properties
				end
			end
		end
	end
end

I don’t get any errors so I have literally no lead on what is causing this to not work. Also the roblox documentation is not very documented. It’s 11:30 pm, my brain is fried and I need help please.