Chat sends system messages and listens to player chat.
Available as the global Chat.
Overview
Methods
- :Broadcast(text: string)
- .broadcast(text: string) deprecated
Events
- .PlayerChatted : Event (player: Player, message: string, chat: ChatMessage)
API
Methods
Broadcast
Broadcast(text: string) : void
Sends a system chat message to everyone in the place. Shown as Server.
Chat:Broadcast("The round has started!")
For a single player, use `Player:Message`.
broadcast
broadcast(text: string) : void deprecated
Identical to Broadcast.
No longer recommended for use.
Events
PlayerChatted
PlayerChatted : Event (player: Player, message: string, chat: ChatMessage)
Triggers when a player sends a chat message, before it is replicated to other players.
Call `chat:Cancel()` to stop the message from being shown in chat.
Useful for commands or filtered messages.
Chat.PlayerChatted:Connect(function(player, message, chat)
if string.sub(message, 1, 1) == "/" then
chat:Cancel()
if message == "/help" then
player:Message("Find the exit!")
end
return
end
end)
ChatMessage
Handle passed as the third argument to PlayerChatted.
Methods
- :Cancel()
Cancel
Cancel() : void
Cancels replication of this chat message.
Other players will not see it.
Calling Cancel more than once does nothing.
