PcoWSkbVqDnWTu_dm2ix
The Developer Hub is now deprecated and information on this page may no longer be accurate. Instead, you should go to our new and improved documentation. You can also learn more about the future of documentation.

Social Interactions

Social Interactions

Your avatar is your identity in any space you enter. The SocialInteractions developer module lets each user better express themselves and their natural movements, adding a touch of realism to the experience.

This module includes the following features:

  • Body Orientation — Makes the head of everyone’s avatar face where their corresponding user’s camera is pointing, through a mix of neck and waist rotation. This provides a subtle cue as to who or what someone else is interacting with.

  • Chat Animations — Adds some liveliness to the in-experience chat by making avatars occasionally play animations, depending on the content of the messages they send. The list of “trigger words” that activate each animation is configurable.

Module Usage

Installation

To use the SocialInteractions module in an experience:

  1. Visit the SocialInteractions marketplace page, click the green Get button, and confirm the transaction.
  2. In Studio, open the toolbox (ViewToolbox).
  3. Select your toolbox Inventory section.
  1. Locate the module item and click it or drag-and-drop it into the 3D view.
  2. In the Explorer window, move the entire SocialInteractions folder into ServerScriptService. Upon running the experience, the module will distribute itself to various services and begin running.

This and other developer modules come with an Install script that runs the installer and distributes the contents of the module to the same services that the folders are named after.

The Install script can be utilized as follows:


EnableLogging — Set to true to enable debug logging for the current developer module. This lets you see how the module gets distributed, along with how each package is linked.


InstallStarted — Fires when the installer first starts up. You can hook into this event to run any pre-install steps.


InstallFinished — Fires when the installer has finished installing the module. By this point, the contents of each service folder has been distributed. You can also hook into this event to run any post-install steps.


Install() — Installs the given developer module by overlaying each of the service folders over existing services. For example, a folder named ReplicatedStorage containing a SocialInteractions script will be distributed to game.ReplicatedStorage.SocialInteractions when installing.


Configuration

Simply inserting the SocialInteractions module will enable both the “body orientation” and “chat animations” feature inside your place. To adjust the default behavior:

  1. In StarterPlayerScripts, create a new LocalScript and rename it to ConfigureSocialInteractions.
  1. Paste the following code into the new script, using the configure() function to customize the module’s behavior.

Chat Animation Trigger Words

The list of “trigger words” that activate each chat animation is configurable and Lua articles/string patterns reference|string patterns are utilized to increase recognizable words. For example, one combination used by the Wave animation is he+y+o*, meaning that hey, heyyy, heyo, heyyyyo, heeeeyyyyo, and other variations qualify to trigger the animation.

Animation Animation ID Word Patterns
Wave 3344650532 hell+o+ h+i+o* wa+[sz]+u+p+ y+o+ greetings* salutations* goo+d+%smorning+ he+y+o* howdy+ what'?s*%s*up+
Applaud 5911729486 ya+y+ h[ou]+r+a+y+ woo+t* woo+h+oo+ bravo+ congratulations+ congrats+ gg pog+ poggers+
Agree 4841397952 ye+s* ye+a+h* y[eu]+p+ o+k+ o+k+a+y+
Disagree 4841401869 no+ no+pe+ yi+ke+s+
Shrug 3334392772 not+%s+sure+ idk+ don't%s+know+ I%s+don't%s+know+ who+%s+knows+
Laugh 3337966527 lo+l+ rof+l+ ha[ha]* he[he]+
Sleep 4686925579 zzz+ yawn+

The list of trigger words that activate each animation is configurable, and additional animations can be added via the setTriggerWordsForChatAnimation() function. For example, the following script links the Tilt animation with the string pattern of cra+zy to support trigger words like crazy and craaaaaazy. It also registers an additional string pattern of coo+l for the Applaud animation to support words like cool and coooool.

API Reference

Functions

configure()

void configure ( table config )

Overrides default configuration options. This function can only be called from a LocalScript.

Key Description Default
useBodyOrientation Toggles the "body orientation" feature. true
waistOrientationWeight Body orientation uses a mix of waist and neck rotation; this parameter determines which of the two is prevalent. This must be a number between 0 and 1.
  • 1 means that only the waist rotates.
  • 0 means that only the neck rotates.
  • Values between give higher or lower weight to waist and neck.
0.5
useChatAnimations Toggles the "chat animations" feature. true
useDefaultTriggerWordsForChatAnimations Chat animations comes with a default list of trigger words. Set this parameter to false if you'd like to turn them off and provide your own. true

setTriggerWordsForChatAnimation()

void setTriggerWordsForChatAnimation ( string animationId, table triggerWords )

Registers a new animation in the chat animation feature. Typing any word that matches a articles/string patterns reference|string pattern included in the triggerWords table will activate the animation whose ID is passed as the first parameter.

Events

onChatAnimationPlayed

RBXScriptSignal onChatAnimationPlayed ( string animationId, string triggerWord )

Fires when a chat animation plays. The connected function receives the animation ID and the word that triggered the animation as its arguments. This event can only be connected in a LocalScript.


Previous Scavenger Hunt