Help with textchatservice setting font and collor

You can write your topic however you want, but you need to answer these questions:

  1. **i am trying to make a textchatservice system message with custom font and color

  2. **it sends this blob of text
    helpme

  3. **i have tried to look through everything, including devforum

-- serverscript
-- game.Players.PlayerAdded:Connect(function(player)
	local color = Color3.fromRGB(31, 1, 255)
	game.ReplicatedStorage.SystemMessage:FireAllClients(string.format(`<font color=\"#{color:ToHex()}" <font size = 18> "Welcome, "..player.DisplayName.."!"}</font></font>`))
end)
-- localscript
game.ReplicatedStorage:WaitForChild("SystemMessage").OnClientEvent:Connect(function(message)
	game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage(message)
end)
game:GetService("TextChatService").OnIncomingMessage = function(textChatMessage)
	local textChannel = textChatMessage.TextChannel
	if textChannel and textChannel.Name == "RBXSystem" then
		local overrideProperties = Instance.new("TextChatMessageProperties")
		overrideProperties.Message = string.format("<font color='#FF0000'>%s</font>", textChatMessage.Text)
		return overrideProperties
	else
		return nil
	end
end

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

2 Likes

it says that because of some incorrect strings :

Correct Script

Here’s the corrected version of both the server script and the local script:

Server Script

game.Players.PlayerAdded:Connect(function(player)
    local color = Color3.fromRGB(31, 1, 255)
    local hexColor = color:ToHex()
    local message = string.format("<font color='#%s' size='18'>Welcome, %s!</font>", hexColor, player.DisplayName)
    game.ReplicatedStorage.SystemMessage:FireAllClients(message)
end)

Local Script

game.ReplicatedStorage:WaitForChild("SystemMessage").OnClientEvent:Connect(function(message)
    game:GetService("TextChatService").TextChannels.RBXGeneral:DisplaySystemMessage(message)
end)

game:GetService("TextChatService").OnIncomingMessage = function(textChatMessage)
    local textChannel = textChatMessage.TextChannel
    if textChannel and textChannel.Name == "RBXGeneral" then
        local overrideProperties = Instance.new("TextChatMessageProperties")
        overrideProperties.Message = string.format("<font color='#FF0000'>%s</font>", textChatMessage.Text)
        return overrideProperties
    else
        return nil
    end
end
2 Likes

thanks but i also want to know how to change the font

1 Like

also it doesnt work it just says “Error occurred while calling TextChatService.OnIncomingMessage: Message is not a valid member of TextChatMessageProperties “Instance””

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.