表情是任何社交体验的核心组成部分。 表情栏 开发者模块 旨在为玩家提供一个可访问、可定制的方式来促进有意义的社交互动。
模块使用
安装
要在体验中使用 表情栏 模块:
确保 模型 排序已选择,然后单击 查看全部 按钮以获取 类别 。
找到并单击 开发模块 瓦片。
找到 表情栏 模块,然后单击它或拖放到 3D 视查看中。
在 浏览器 窗口中,将整个 EmoteBar 模型移至 ServerScriptService 。在运行体验时,模块将分配到各种服务并开始运行。
配置
模块预配备了 7 个表情,您可以轻松自定义自己的表情和显示选项。此外,如果玩家拥有以前的 Roblox 活动(例如 Lil Nas X、Royal Blood 或 Twenty One Pilots)的任何表情,那些表情将自动添加到可用表情列表。
在 服务器脚本服务 中,创建一个新的 Script 并将其重命名为 配置表情符号 。
将以下代码粘贴到新的 配置表情 脚本中。useDefaultEmotes 设置的 false 覆盖了默认表情,让你通过 setEmotes 函数定义自定义表情。
脚本 - 配置表情local ReplicatedStorage = game:GetService("ReplicatedStorage")local EmoteBar = require(ReplicatedStorage:WaitForChild("EmoteBar"))EmoteBar.configureServer({useDefaultEmotes = false,})EmoteBar.setEmotes({{name = "Hello",animation = "rbxassetid://3344650532",image = "rbxassetid://7719817462",defaultTempo = 1,},{name = "Applaud",animation = "rbxassetid://5915693819",image = "rbxassetid://7720292217",defaultTempo = 2,},})
超级表情
当多个玩家在同一区域执行相同的表情时,会形成一个 超级表情 。随着越来越多的玩家加入,超级表情变得更大。当玩家停止表演动作时,超级表情最终会变得更小,直到最后消失。

速度
一个动作的 速度 是当其按钮按一次时播放的速度。表动作的默认速度由其 defaultTempo 决定。通过快速或慢速点击按钮来增加或减少表情的速度。
API 参考
类型
表情
每个表情都由以下键值对表示的词典:
关键 | 类型 | 描述 |
---|---|---|
name | 字符串 | 表情名称,例如 "Shrug" . |
animation | 字符串 | 表情动画的资产ID。 |
image | 字符串 | 图形GUI界面中的动作图像的资产ID。 |
defaultTempo | 数字 | 默认播放表情动画的速度因子。例如,2的速度将播放动画的两倍正常速度。必须大于 0。 |
isLocked | bool | 是否禁止表情被激活。 |
枚数
表情栏。贵类型
名称 | 摘要 |
---|---|
EmoteBar | 默认形式,在屏幕底部的栏中显示表情,分为单个“页”。 |
EmoteWheel | 当玩家单击或点击他们的玩家角色时,变体中显示表情的环环。 |
本地脚本
local ReplicatedStorage = game:GetService("ReplicatedStorage")local EmoteBar = require(ReplicatedStorage:WaitForChild("EmoteBar"))EmoteBar.configureClient({guiType = EmoteBar.GuiType.EmoteWheel,})
功能
配置 сервер
配置服务器(配置: table )
通过以下键/值在 config 表中覆盖默认服务器配置选项,来实现以下功能:此函数只能从 Script 调用,更改将自动复制到所有客户端。
关键 | 描述 | 默认 |
---|---|---|
useDefaultEmotes | 是否包含提供的默认表情。 | 真实 |
useMegaEmotes | 启用或禁用 超级表情 精选能。 | 真实 |
emoteMinPlayers | 最少数量的玩家执行相同的表情来贡献超级动作。 | 3 |
emoteMaxPlayers | 最大数量的玩家执行相同的表情来贡献超级动作。 | 50 |
playParticles | 启用或禁用玩家使用的表情,让它们漂浮在头顶上的粒子。 | 真实 |
sendContributingEmotes | 启用或禁用向大型表情贡献小型表情图标的发送。 | 真实 |
脚本
local ReplicatedStorage = game:GetService("ReplicatedStorage")local EmoteBar = require(ReplicatedStorage:WaitForChild("EmoteBar"))EmoteBar.configureServer({emoteMinPlayers = 2,playParticles = false,})
配置客户端
配置客户端(config: table )
通过以下键/值在 config 表中覆盖默认客户端配置选项,来实现以下功能:此函数只能从 LocalScript 中调用。根据 guiType 的值,注释标签中的选项也适用。
关键 | 描述 | 默认 |
---|---|---|
guiType | 形成图形用户界面的控件将用于显示表情(表情栏.GuiType)。 | 表情栏 |
useTempo | 启用或禁用用户能够通过重复激活同一节奏的表情来控制表情播放速度的 节奏 功能。 | 真实 |
tempoActivationWindow | 用户在进行连续激活表情时间的数量,以秒为单位,用于计算为节奏的一部分。 | 3 |
lockedImage | 图像用于显示顶部锁定的表情。 | “rbxassetid://6905802778” |
本地脚本 - 表情栏
local ReplicatedStorage = game:GetService("ReplicatedStorage")local EmoteBar = require(ReplicatedStorage:WaitForChild("EmoteBar"))EmoteBar.configureClient({guiType = EmoteBar.GuiType.EmoteBar,maxEmotesPerPage = 6,nextPageKey = Enum.KeyCode.Z,prevPageKey = Enum.KeyCode.C,})
本地脚本 - 表情轮子
local ReplicatedStorage = game:GetService("ReplicatedStorage")local EmoteBar = require(ReplicatedStorage:WaitForChild("EmoteBar"))EmoteBar.configureClient({guiType = EmoteBar.GuiType.EmoteWheel,})
设置表情
设置表情(表情: table )
设置要使用的自定义表情。如果 useDefaultEmotes 是 true ,这些将被添加到默认值中,或者如果 useDefaultEmotes 是 false ,则会替换默认值。此函数只能从 Script 调用,更改将自动复制到所有客户端。
请参阅表情以获取每个表情传递到此函数的结构。
脚本 - 配置表情
local ReplicatedStorage = game:GetService("ReplicatedStorage")local EmoteBar = require(ReplicatedStorage:WaitForChild("EmoteBar"))EmoteBar.configureServer({useDefaultEmotes = false,})EmoteBar.setEmotes({{name = "Hello",animation = "rbxassetid://3344650532",image = "rbxassetid://7719817462",defaultTempo = 1,},{name = "Applaud",animation = "rbxassetid://5915693819",image = "rbxassetid://7720292217",defaultTempo = 2,},})
设置GUI可见性
setGuiVisibility(可见: boolean )
显示或隐藏表情图形GUI界面。此功能只能从特定客户端的 LocalScript 调用。
本地脚本
local ReplicatedStorage = game:GetService("ReplicatedStorage")local EmoteBar = require(ReplicatedStorage:WaitForChild("EmoteBar"))EmoteBar.setGuiVisibility(false)
获取表情
通过名称获取 表情。返回 nil 如果无法找到表情,则返回。此函数只能从特定客户端的 LocalScript 调用。
本地脚本
local ReplicatedStorage = game:GetService("ReplicatedStorage")local EmoteBar = require(ReplicatedStorage:WaitForChild("EmoteBar"))local shrug = EmoteBar.getEmote("Shrug")
播放表情
播放表情(动作: 表情 )
播放指定的 表情 并在服务器上发射 表情已发射 事件,如果连接。此函数只能从特定客户端的 LocalScript 调用。
本地脚本
local ReplicatedStorage = game:GetService("ReplicatedStorage")local EmoteBar = require(ReplicatedStorage:WaitForChild("EmoteBar"))local shrug = EmoteBar.getEmote("Shrug")EmoteBar.playEmote(shrug)
锁定表情
锁定表情(表情名称: string )
用给定的名称锁定 表情。此函数只能从客户端的 LocalScript 调用。
本地脚本
local ReplicatedStorage = game:GetService("ReplicatedStorage")local EmoteBar = require(ReplicatedStorage:WaitForChild("EmoteBar"))EmoteBar.lockEmote("Applaud")
解锁表情
解锁表情(表情名称: string )
使用给定名称解锁 表情。此函数只能从客户端的 LocalScript 调用。
本地脚本
local ReplicatedStorage = game:GetService("ReplicatedStorage")local EmoteBar = require(ReplicatedStorage:WaitForChild("EmoteBar"))EmoteBar.unlockEmote("Applaud")
事件
已播放表情
当任何客户端播放动作时发生火焰。此事件只能在 LocalScript 中连接。
本地脚本
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local EmoteBar = require(ReplicatedStorage:WaitForChild("EmoteBar"))
EmoteBar.emotePlayed:Connect(function(player, emote)
print(player.Name, "played", emote.name)
end)
锁定表情已激活
当客户端单击锁定的动作时发生火焰。此事件只能在 LocalScript 中连接。
参数 | |
---|---|
动作:表情 | 已激活的锁定表情。 |
本地脚本
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local EmoteBar = require(ReplicatedStorage:WaitForChild("EmoteBar"))
EmoteBar.lockedEmoteActivated:Connect(function(emote)
print(Players.LocalPlayer, "clicked", emote.name)
end)