Why Am I not seeing announcement

still new to scripting in Roblox this is a local script in StarterGui. I am getting the print(message) in the output, but I am not seeing the announcement its suppose to be displaying.

local replicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = replicatedStorage:WaitForChild("RemoteEvent")

remoteEvent.OnClientEvent:Connect(function(message)
	
	print(message)

	
	local success, err = pcall(function()
		game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage", {
			Text = message,
			Color = Color3.fromRGB(255, 255, 0), -- Yellow color
			Font = Enum.Font.SourceSansBold,
			FontSize = Enum.FontSize.Size24
		})
	end)

	if not success then
		warn("Failed to set system message: " .. tostring(err))
	end
end)

No errors, just not seeing the displayed message

1 Like

It seems like this function is defunct with the new chat interface. Luckily, you can send and decorate system messages fairly easily with TextChannel:DisplaySystemMessage() and TextChannel.OnIncomingMessage.

You can familiarize yourself with rich text for further customization.

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

local remoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")

local FONT_COLOR = Color3.fromRGB(255, 255, 0):ToHex()

local channel = Instance.new("TextChannel")
channel.Name = "SystemChannel"
channel.Parent = TextChatService:WaitForChild("TextChannels")

channel.OnIncomingMessage = function(message)
	local props = Instance.new("TextChatMessageProperties")
	props.PrefixText = "[System]"
	props.Text = `<font color='#{FONT_COLOR}'>{message.Text}</font>`
	return props
end

remoteEvent.OnClientEvent:Connect(function(message)
	channel:DisplaySystemMessage(message)
end)
2 Likes

Thanks this got it to work!! Quick Question how can I change the font colour of “system”?

1 Like

The prefix can use rich text as well:

local PREFIX_COLOR = Color3.fromRGB(255, 0, 0):ToHex()
props.PrefixText = `<font color='#{PREFIX_COLOR}'>[System]</font>`
1 Like

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