I decided to revamp the Roblox /e system. (Like /e dance, /e laugh, /e wave, etc.)
Put the following code in a LocalScript.
Also the code is for TextChatService and on line 11 you can switch if you want /e sit or not. (My reason to revamp the /e system was to add /e sit.)
Edit: I didnt put /e point so i added it.
Edit 2: i added custom emote support so you can add custom emotes and started using tables because of @Thunder234YT (and because i had to use tables for custom emote support)
Edit 3: I removed all of the textchatcommands except for the /e one.
game:GetService("TextChatService"):WaitForChild("TextChatCommands"):WaitForChild("RBXEmoteCommand"):Destroy()
game.Players.LocalPlayer.CharacterAdded:Wait()
local RBXNothingCommand=Instance.new("TextChatCommand")
local emotes={"/emote dance","/e dance","/emote dance1","/e dance1","/emote dance2","/e dance2","/emote dance3","/e dance3","/emote laugh","/e laugh","/emote cheer","/e cheer","/emote wave","/e wave","/emote point","/e point","/emote","/e","/emote sit","/e sit"}
local IsSitCommandActivated=true
local function AddAnimation(animationlink:string,animationname:string)
game.Players.LocalPlayer.CharacterAdded:Connect(function(character:Model)
local stringval=Instance.new("StringValue")
local newanim=Instance.new("Animation")
table.insert(emotes,"/emote "..animationname)
table.insert(emotes,"/e "..animationname)
stringval.Name=animationname
stringval.Parent=character:WaitForChild("Animate")
newanim.Parent=stringval
newanim.Name=animationname.."Anim"
newanim.AnimationId=animationlink
RBXNothingCommand.Triggered:Connect(function(textsource,msg)
local player:Player=game.Players:GetPlayerByUserId(textsource.UserId)
local humanoid:Humanoid=player.Character:WaitForChild("Humanoid")
humanoid.Died:Connect(function()
stringval:Destroy()
newanim:Destroy()
end)
if msg~="/emote "..animationname and msg~="/e "..animationname then return end
local animationtrack=humanoid:WaitForChild("Animator"):LoadAnimation(newanim)
animationtrack:Play()
end)
end)
end
RBXNothingCommand.Parent=game.TextChatService:WaitForChild("TextChatCommands")
RBXNothingCommand.Name="RBXEmotesCommand"
RBXNothingCommand.PrimaryAlias="/emote"
RBXNothingCommand.SecondaryAlias="/e"
RBXNothingCommand.AutocompleteVisible=false
RBXNothingCommand.Triggered:Connect(function(textsource,msg)
local player:Player=game.Players:GetPlayerByUserId(textsource.UserId)
if msg.lower(msg)==emotes[1] or msg.lower(msg)==emotes[2] then
local result=math.random(1,3)
if result==1 then
if player.Character:WaitForChild("Humanoid").RigType==Enum.HumanoidRigType.R15 then
player.Character.Animate.PlayEmote:Invoke("dance")
else
player.Character.Animate.PlayEmote:Invoke("dance1")
end
elseif result==2 then
player.Character.Animate.PlayEmote:Invoke("dance2")
else
player.Character.Animate.PlayEmote:Invoke("dance3")
end
end
if msg.lower(msg)==emotes[3] or msg.lower(msg)==emotes[4] then
if player.Character:WaitForChild("Humanoid").RigType==Enum.HumanoidRigType.R15 then
player.Character.Animate.PlayEmote:Invoke("dance")
else
player.Character.Animate.PlayEmote:Invoke("dance1")
end
end
if msg.lower(msg)==emotes[5] or msg.lower(msg)==emotes[6] then
player.Character.Animate.PlayEmote:Invoke("dance2")
end
if msg.lower(msg)==emotes[7] or msg.lower(msg)==emotes[8] then
player.Character.Animate.PlayEmote:Invoke("dance3")
end
if msg.lower(msg)==emotes[9] or msg.lower(msg)==emotes[10] then
player.Character.Animate.PlayEmote:Invoke("laugh")
end
if msg.lower(msg)==emotes[11] or msg.lower(msg)==emotes[12] then
player.Character.Animate.PlayEmote:Invoke("cheer")
end
if msg.lower(msg)==emotes[13] or msg.lower(msg)==emotes[14] then
player.Character.Animate.PlayEmote:Invoke("wave")
end
if msg.lower(msg)==emotes[15] or msg.lower(msg)==emotes[16] then
player.Character.Animate.PlayEmote:Invoke("point")
end
if msg.lower(msg)==emotes[19] or msg.lower(msg)==emotes[20] and IsSitCommandActivated==false then
if player.Character:WaitForChild("Humanoid").RigType==Enum.HumanoidRigType.R15 then
game:GetService("TextChatService").TextChannels.RBXSystem:DisplaySystemMessage("You do not own this emote.","Error")
else
game:GetService("TextChatService").TextChannels.RBXSystem:DisplaySystemMessage("Switch to your R15 avatar to play Emote.","Error")
end
end
if msg.lower(msg)==emotes[19] or msg.lower(msg)==emotes[20] and IsSitCommandActivated==false then return end
if msg.lower(msg)==emotes[19] or msg.lower(msg)==emotes[20] and IsSitCommandActivated==true then
player.Character:WaitForChild("Humanoid").Sit=true
end
if msg.lower(msg)==emotes[17] or msg.lower(msg)==emotes[18] then
game:GetService("TextChatService").TextChannels.RBXSystem:DisplaySystemMessage("Emote does not exist.","Error")
end
for i,v in ipairs(emotes) do
if msg.lower(msg)==emotes[i] then return end
if msg.lower(msg)~=emotes[i] and i>=#emotes then
if player.Character:WaitForChild("Humanoid").RigType==Enum.HumanoidRigType.R15 then
game:GetService("TextChatService").TextChannels.RBXSystem:DisplaySystemMessage("You do not own this emote.","Error")
else
game:GetService("TextChatService").TextChannels.RBXSystem:DisplaySystemMessage("Switch to your R15 avatar to play Emote.","Error")
end
end
end
end)