Custom chat animation "/e sit"

Hello,

I’m trying to make custom chat animations, via the chat ofc. For example if a player does /e sit it does a custom sit animation that allows them to move, still be doing the animation but to stop doing the animation they have to do another command called “/e unsit”. I tried looking for other threads on people trying to find or a way to do this but the ones I found aren’t like the one’s I’m looking for. I attempted at trying to do it on my own but it exceeded my scripting capabilities as I am still a beginner.

I was wondering if anyone has made this type of script before, or for someone to lead me to the right path on making it.

Thanks for checking out my thread.

1 Like

Can you post your attempt so we can give you feedback on how to improve it?

Anyway, you can do this via the Player.Chatted event to see when a player has chated. Then, you can check the message to see if it matches the commands. If the message matches, play/stop the animation.

1 Like

You can do this:

local Anim = Instance.new("Animation")
Anim.AnimationId = ""

game.Players.PlayerAdded:Connect(function(player)
    local track
    player.Chatted:Connect(function(msg)
        if msg:lower() == "/e sit" then
            track = player.Character.Humanoid:LoadAnimation(Anim)
            track.Looped = true
            track:Play()
        elseif msg:lower() == "/e unsit" then
            if track then
                track:Stop()
            end
        end
    end)
end)

Also, yes I know this isn’t very neat but I’m not on pc atm.

3 Likes

I’ve found this method:

game.Players.PlayerAdded:Connect(function(plr)
	plr.Chatted:Connect(function(msg)
		if msg == "/e sit" then
			print("ABLE TO SIT")
		end
	end)
end)

Only downside to this is a message in the chat pops up saying “you cant use that emote” even though the script works. You can add an elseif for the unsit command as well.

Hey, I checked out the script and it doesn’t particularly work…

did you change the animation Id to your animation’s id?

Yes I did change the animation id to one I own.

oh, actually there is a reason for that, let me fix it real quick.
Edit: I just edited the script I gave you earlier. It should work now

1 Like

https://gyazo.com/381b60f80acc1050bd09c3315096ea32

That behavior may be due to the Roblox chat system not interpreting that as a message sent. Nobody actually sees the /e sit, so this may be the case.

just a quick tip, but you should probably use msg:lower() or string.lower() to change all letters in their message to lowercase

also @A_thruZAlt, i believe that it wouldn’t make sense because the .Chatted event still occurs when you spam something and the message doesn’t come up in the chat

When you mentioned:

Do you mean spamming in chat and the message filters?

no, i meant as in spamming and then the message doesn’t appear because you kept typing a lot of messages in a short period of time. however, the .Chatted still fires even when the system tells you that you have x amount of seconds remaining before you can message

what did you put as the animation id? it could be that you didnt do “rbxassetid://” then the animation id

I would recommend caching the loaded animation and loading it on the client instead. str:func() is slower than string.func(str). Also if you wanna add a lot of custom commands without too much spaghetti here is what you could do. @ISieSky

local Player = game.Players.LocalPlayer
local Callbacks = {
    Sit = function()

    end
}

Player.Chatted:Connect(function(Message)
    local Function = string.match("/e") and string.gsub(Message, 3, #Message)

    if Function then
        Callbacks[Function]()
    end
end)
1 Like

It works now but it appears the characters animation makes them float above the surface and the normal roblox animation overrides the actual sitting animation.

https://gyazo.com/fef4f84b49be464c9715701d9eb9d529

Make the walkspeed to zero when playing the animation and when lets say the player jumps change it to normal.