PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

Chat

This function makes the local player chat the given message. Since this item is protected, attempting to use it in a Script or LocalScript will cause an error.

Instead, when creating a custom chat system, or a system that needs access to the chat, you can use the Chat service’s Chat/Chat function instead.

See also

  • articles/Lua-Chat-System|Lua Chat System, a tutorial for creating a more advanced chat system

Parameters

Name Type Default Description

The message chatted.

Returns

Return Type Summary

No return.


Code Samples


Players:Chat

This example demonstrates that the Players/Chat function executes without error if using the Command Bar or a Plugin (assuming the local player can chat freely) and errors if executed in a Script.

-- Command bar
game.Players:Chat("Hello, world!") --Results in 'Hello, world!' appearing in the Chat log under your Player's name.

-- Script
game.Players:Chat("Hello, world!") --Errors