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

TeamChat

This function makes the Players/LocalPlayer chat the given message, which will only be viewable by users on the same team. Since this item is protected, attempting to use it in a Script or LocalScript will cause an error.

This function is used internally when the Players/LocalPlayer sends a message to their team.

If you would like to create a custom chat system where you can define custom functions such as these, take a look at the tutorial here.

Parameters

Name Type Default Description

The message being chatted.

Returns

Return Type Summary

No return.


Code Samples


Sending Team Chat

This example demonstrates that the Players/TeamChat function executes without error if using the Command Bar or a Plugin and errors if executed in a LocalScript.

When executed in the Command Bar, the function sends the specified message to all players on the same Team as the Players/LocalPlayer.

-- Command bar
game.Players:TeamChat("Hello World") -- Sends a "Hello World" message to all players on the local player's team

-- LocalScript
local player = game.Players:TeamChat("Hello World") -- Errors