Emotes are expressive character animations that are accessible by using chat commands ("/e cheer") or by accessing the emotes menu on the top right of any experience. All users have access to default emotes, such as dance, point, and cheer. Additional avatar emotes can be purchased and equipped from the Marketplace.
In your experience, you can perform the following emote customizations:
- Open and close a user's emotes menu programmatically.
- Add or remove emotes options from a user's menu.
- Disable access to the menu.
- Play an emote, targeting a specific user character.
Emotes Menu
You can open and close a user's emote menu manually, customize the menu to display specific emotes, or disable the menu completely.
Opening and Closing
To manually open or close a player's emote menu, call GuiService:SetEmotesMenuOpen() with a boolean value of true or false.
The following code sample will open the emotes menu for the user:
-- Open the emote Menulocal GuiService = game:GetService("GuiService")GuiService:SetEmotesMenuOpen(true)
If you need to detect whether the emotes menu is open, call GuiService:GetEmotesMenuOpen(). This returns a boolean indicating the menu's current state.
Adding and Removing Emotes
Customize the emote menu by setting emotes from the catalog and then equipping emotes to a Humanoid. Set emotes with the HumanoidDescription:SetEmotes() method and equip up to 8 emotes to the emotes menu using HumanoidDescription:SetEquippedEmotes().
Use the following code sample in a LocalScript within the StarterCharacterScripts folder to set and equip emotes in your experience:
local Players = game:GetService("Players")local humanoid = Players.LocalPlayer.Character.Humanoidlocal humanoidDescription = humanoid.HumanoidDescription-- Set custom emotes within a tablelocal emoteTable = {["Hello"] = {3576686446},["Stadium"] = {3360686498},["Tilt"] = {3360692915},["Shrug"] = {3576968026},["Salute"] = {3360689775},["Point"] = {3576823880}}humanoidDescription:SetEmotes(emoteTable)-- Equip emotes in a specific orderlocal equippedEmotes = {"Hello", "Stadium", "Tilt", "Shrug", "Salute", "Point"}humanoidDescription:SetEquippedEmotes(equippedEmotes)
Disabling
Disable the emotes menu with StarterGui:SetCoreGuiEnabled(). Disabling the emotes menu will not prevent emotes from being performed with a chat command.
The following sample code will disable the emotes menu:
local StarterGui = game:GetService("StarterGui")StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.EmotesMenu, false)
In addition to disabling the menu, you can disable loading of user-owned emotes by setting the StarterPlayer.UserEmotesEnabled property within StarterPlayer > Character to false. This specific property can only be set in Studio and cannot be set by scripts.
Playing Emotes
To manually play an emote that a character has in its HumanoidDescription, call Humanoid:PlayEmote(), passing the string name of the emote. This call will return true to indicate that the emote was played successfully, or false otherwise.
Use the following code sample to play the Shrug emote:
local Players = game:GetService("Players")local humanoid = Players.LocalPlayer.Character.Humanoidhumanoid:PlayEmote("Shrug")