I know lots of games have their own animations when you type something in the chat preceded by "/e". (or maybe it's /c...). Is there an easy way for me to bind an animation to whenever a player types "/e ANIMNAME", where ANIMNAME is any string I want?
How Can I Make My Own "/e" Animations for Players?
1 answer
I made a script:
local anim = game:GetService("ReplicatedStorage"):WaitForChild("Animation") --where your animation is
local text = "/e justice" --what to say
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
local pmsg = msg:lower()
if pmsg == text then
if plr.Character then
local a = plr.Character.Humanoid:LoadAnimation(anim)
a:Play()
end
end
end)
end)
I put the animation in ReplicatedStorage, this does though show the Roblox messages saying you cant use this animation. It does still work, I'm not sure how to get rid of that message.
Here is a GIF of it: https://gyazo.com/712b31bae8d01d4781a60d4c9a578249
Basically what this does is first of all waiting for player to be added, then if they chat we take the message and convert it to lower letters so this works even when you have upper-/lowercase letters. Then we just check for they character and then plays the animation.
3 comments
For whatever reason, this doesn't work for me. It does give me that error message in the chat, but still doesn't play.
Did you add the animation and change the local anim to wherever the animation is? And make sure you put a animation id in it. (Btw you can't use someone else's animation)
Did you put this in a localscript or serverscript (this is a serverscript)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
If you would like to do it that way, my solution is to use the string library and find a pattern that’s able to read the ANIMNAME separately from the rest of the string.
You can read about changing the default /e animations here, as well as changing any other types of default animations https://developer.roblox.com/en-us/articles/using-animations-in-games