Issue with chat

hi, im making a game with my friend, and we’re running into this issue. the space between the prefixtext and the normal text isnt there (when the tags gets added). image below>>

image

code:

local TextChatService = game:GetService("TextChatService")

TextChatService.OnIncomingMessage = function(Message)
	local Properties = Instance.new("TextChatMessageProperties")

	if Message.TextSource ~= nil then
		local player = game:GetService("Players"):GetPlayerByUserId(Message.TextSource.UserId)
		local hasVerifiedBadge = false

		local Text = ""
		local Tags, lbtag = game.ReplicatedStorage.Events.GetPlayerTags:InvokeServer(Message.TextSource.UserId)

		local lbtagfr = ""


		if lbtag then
			lbtagfr = "<font size='18'><font face='GothamBold'><font color='#"..lbtag.TagColor:ToHex().."'>["..lbtag.TagText.."] </font></font></font>"
		end

		if Tags then
			for i, v in pairs(Tags) do
				if v ~= nil then
					Text = Text.. "<font size='18'><font face='GothamBold'><font color='#"..v.TagColor:ToHex().."'>["..v.TagText.."] </font></font></font>"
				end
			end
		end
		Text = Text..lbtagfr
		if player then
			hasVerifiedBadge = table.find(require(game.ReplicatedStorage.Admin), player.UserId)
		else
			return Instance.new("TextChatMessageProperties")
		end

		if hasVerifiedBadge then
			Text = Text..player.DisplayName.."\238\128\128: "
		else
			Text = Text..player.DisplayName..": "
		end
		
		Properties.PrefixText = Text
	end

	return Properties
end

edit//

looks like it gets pushed in further as each tag gets added

image

Im not entirely sure but i think you have to add a space before the colon here

So it looks like this:

Text = Text..player.DisplayName.."\238\128\128 : "
1 Like

just tried this, it still does the same thing. its super weird

Hey, I think I’ve found your issue, but I am not entirely sure as I didn’t test it.


TextChatService.OnIncomingMessage = function(Message)
	local Properties = Instance.new("TextChatMessageProperties")

	if Message.TextSource ~= nil then
		local player = game:GetService("Players"):GetPlayerByUserId(Message.TextSource.UserId)
		local hasVerifiedBadge = false

		local Text = ""
		local Tags, lbtag = game.ReplicatedStorage.Events.GetPlayerTags:InvokeServer(Message.TextSource.UserId)

		local lbtagfr = ""

		if lbtag then
			lbtagfr = "<font size='18'><font face='GothamBold'><font color='#"..lbtag.TagColor:ToHex().."'>["..lbtag.TagText.."] </font></font></font>"
		end

		if Tags then
			for i, v in pairs(Tags) do
				if v ~= nil then
					Text = Text .. "<font size='18'><font face='GothamBold'><font color='#"..v.TagColor:ToHex().."'>["..v.TagText.."] </font></font></font>"
				end
			end
		end
		Text = Text .. lbtagfr

		if player then
			hasVerifiedBadge = table.find(require(game.ReplicatedStorage.Admin), player.UserId)
		else
			return Instance.new("TextChatMessageProperties")
		end
		if hasVerifiedBadge then
			Text = Text .. player.DisplayName .. "\238\128\128: "
		else
			Text = Text .. player.DisplayName .. ": "
		end
		
		Properties.PrefixText = Text
	end

	return Properties
end

Let me know if this fixes your issue!

hmm, the issue still persists. what did you change if I may ask?

I had a similar issue before, it’s because of the font you use. I fix the issue by adding an additional space since the size of the text font makes the spacing almost unnoticeable with only 1 space.

I’m not sure if it works

local TextChatService = game:GetService("TextChatService")

TextChatService.OnIncomingMessage = function(Message)
	local Properties = Instance.new("TextChatMessageProperties")

	if Message.TextSource ~= nil then
		local player = game:GetService("Players"):GetPlayerByUserId(Message.TextSource.UserId)
		local hasVerifiedBadge = false

		local Text = ""
		local Tags, lbtag = game.ReplicatedStorage.Events.GetPlayerTags:InvokeServer(Message.TextSource.UserId)

		local lbtagfr = ""


		if lbtag then
			lbtagfr = "<font size='18'><font face='GothamBold'><font color='#"..lbtag.TagColor:ToHex().."'>["..lbtag.TagText.."] </font></font></font>"
		end

		if Tags then
			for i, v in pairs(Tags) do
				if v ~= nil then
					Text = Text.. "<font size='18'><font face='GothamBold'><font color='#"..v.TagColor:ToHex().."'>["..v.TagText.."] </font></font></font>"
				end
			end
		end
		Text = Text..lbtagfr
		if player then
			hasVerifiedBadge = table.find(require(game.ReplicatedStorage.Admin), player.UserId)
		else
			return Instance.new("TextChatMessageProperties")
		end

		if hasVerifiedBadge then
			Text = Text..player.DisplayName.."\238\128\128:  "
		else
			Text = Text..player.DisplayName..":  "
		end
		
		Properties.PrefixText = Text
	end

	return Properties
end

hmm I don’t know. I tried adding like 10 spaces, and it didn’t do anything. it’s super weird

didn’t work unfortunately, I think it might be a roblox bug