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!!
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
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.