I'm trying to add custom emotes into my game, but there are a few bugs with the animations
Heres what happens when you start walking https://gyazo.com/bc9b9112f40d8a38c29366edfc77e1aa (Link doesn't work, so to see the issue you have to copy or paste in your browser, or don't)
Code
local plr = game:GetService('Players').LocalPlayer local emotes = { sit = "rbxassetid://withdrawn", }; function stopAnims() local Humanoid = game.Players.LocalPlayer.Character.Humanoid local ActiveTracks = Humanoid:GetPlayingAnimationTracks() for _,v in pairs(ActiveTracks) do v:Stop() end end for i,v in pairs(emotes) do local anim = Instance.new('Animation') anim.AnimationId = v emotes[i] = plr.Character.Humanoid:LoadAnimation(anim) emotes[i].Priority = Enum.AnimationPriority.Core end plr.Chatted:connect(function(message) if message:sub(1,3) == "/e " then local emote = message:sub(4) emote = emotes[emote] if emote then if not emote.IsPlaying then stopAnims() emote:Play() end end end end)
Since you're walking when you try to sit, roblox is already playing an animation so it won't let you play another. The easiest fix would to be setting their walkspeed to 0 for a second so it can play.
if not emote.IsPlaying then plr.Walkspeed = 0 stopAnims() emote:Play()