Any reason why the bold richtext won't stop?

The richtext won’t stop after the </b>. I have tried for countless hours for this to work but it just won’t. Please help.

Server script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local logMessageEvent = ReplicatedStorage:WaitForChild("Events"):WaitForChild("Other"):WaitForChild("SendLog")

return function(context, text, color)
	local player = context.Executor
	local playerrank = player:GetRankInGroup(8423759)
	local currentTime = os.date("*t")
	local time = os.date("%d/%m/%Y, %X", os.time())

	local rankTitles = {
		[6] = "Moderator",
		[7] = "Administrator",
		[8] = "Developer",
		[9] = "Manager",
		[255] = "Owner",
	}

	local rankTitle = rankTitles[playerrank] or "Unknown"

	local colorCode
	if color == "Orange" then
		colorCode = "#FFA500"
	elseif color == "Red" then
		colorCode = "#ff4346"
	elseif color == "Green" then
		colorCode = "#00FF7F"
	elseif color == "Blue" then
		colorCode = "#87CEEB"
	else
		colorCode = "#FFFFFF"
	end

	local message = string.format("[%s] | %s", time, text)
	logMessageEvent:FireAllClients(string.format("<font color='%s'><b>%s</b></font>", colorCode, message), color)
	return "Fired, check logs channel."
end

Client script:

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

local logWelcomeEvent = ReplicatedStorage:WaitForChild("Events"):WaitForChild("Other"):WaitForChild("LogEvent")
local staffWelcomeEvent = ReplicatedStorage:WaitForChild("Events"):WaitForChild("Other"):WaitForChild("StaffEvent")
local logMessageEvent = ReplicatedStorage:WaitForChild("Events"):WaitForChild("Other"):WaitForChild("SendLog")

local function sendWelcomeMessage(channelName, message)
	local channel = game:GetService("TextChatService"):WaitForChild("TextChannels"):WaitForChild(channelName)
	if channel then
		channel:DisplaySystemMessage(string.format("<font color='#D3D3D3'>%s</font>", message:format(Players.LocalPlayer.Name)))
	end
end

staffWelcomeEvent.OnClientEvent:Connect(function(message)
	sendWelcomeMessage("Staff", message)
end)

logWelcomeEvent.OnClientEvent:Connect(function(message)
	sendWelcomeMessage("Logs", message)
end)

logMessageEvent.OnClientEvent:Connect(function(text)
	local channel = game:GetService("TextChatService"):WaitForChild("TextChannels"):WaitForChild("Logs")
	if channel then
		channel:DisplaySystemMessage(string.format("<font color='#FFFFFF'><b>%s</b></font>", text))
	end
end)

Thanks :heart:

EDIT: No errors, literally just the whole string becomes bold no matter what.

logMessageEvent:FireAllClients(string.format("<font color='%s'><b>%s</b></font>", colorCode, message), color)

You are formatting the whole string with that.

maybe try putting the text you want formatted in a variable like

local boldtext = string.format("<font color='%s'><b>%s</b></font>", textToBeBold)

and THEN add that to the string being sent.

I’ve done that, maybe could you give me a snippet of what textToBeBold would be??

I was just giving an example text.

Here is me having a separation of formatted and unformatted text in a script of my own.

local styledNewsLine = string.format('<i><font color="rgb(131, 42, 255)" size="14">%s %s</font></i>', news, newsLines[newsNum])
textChannel:DisplaySystemMessage(styledNewsLine .. "rizz")

rizz is unformatted. (added that for texting)

image

Should I change this in the client or server script?

EDIT: going for a shower now, be back soon

EDIT 2: I’m back, could you give me a snippet out of my own code?

1 Like

Probably the Client script.

The problem with your script is it is probably all handled on a client. Mine is handled on both.

Any way you could help me split it up into 2 codes using the script I gave above?

Still needing help on this.

Ima just say, try doing what I said on both the client and the server. (The “have the text you want bold in a separate variable” thing)

1 Like

I managed to fix this doing this:

local boldmessage = string.format("[%s] @%s:", time, playerName)
local message = string.format("%s", text)
local formattedText = string.format("<font color='%s'><b>%s</b> %s</font>", colorCode, boldmessage, message)

Leaving this for future readers. Thanks @trtman33!

1 Like