Chat System Message not sending

Hi,

I want to make it so that whenever someone steps on a checkpoint, it sends a "You have reached [stage] stage! However, I’m having trouble sending it in the chat.

This is by a local script:


chatMessage.OnClientEvent:Connect(function(playerName, stageName, color)
	print('got the client event')
	print(playerName, stageName, color)
	if playerName == plr then
		local succ, err = pcall(function()
			game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage", {
				Text = "You have reached the " ..stageName.. " stage!",
				Color = color,
				Font = Enum.Font.GothamBold,
				TextSize = 18
			})
		end)
		if succ then
			print('Success!')
		else
			print(err)
		end
	else

It prints “Success!” after the pcall(), even though I see no message in the chat. Please help!!

why are you putting it in a pcall

1 Like

anyways gotham is deprecated now so try using another font

1 Like

its better practice. and removing the pcall() doesn’t fix it

did you try changing the font though

yes i did

kasdhflkasjdhflajksdhflkjasdhflkjasdhflkajsdhflkasjdhfklajsdhf

cant help ya then. also, while its generally true that using pcall can be good practice, it should only be for problems that cant be avoided, like pathfinding failing. it shouldnt be used for every single function

1 Like

are you using textchatservice or legacy

i am using the new version

kjashdkjsad

plr is an object and playerName is a string right?

The API is different on TextChatService.

local TextChatService = game:GetService("TextChatService")
local TextChannels = TextChatService:WaitForChild("TextChannels")
TextChannels.RBXSystem:DisplaySystemMessage('<font face="Michroma" color="rgb('..math.floor(color.R*255)..','..math.floor(color.G*255)..','..math.floor(color.B*255)..')">You have reached the '..stageName..' stage!</font>')

Replace the setcore code with this and add the variables on the top of your code.

1 Like