alright so i made a very simple chat emote system but then i ran into the issue of course where the animations dont stop so i hooked it up to all humanoid events that stop animations and then it started erroring and acting like my function doesnt even exist
LocalScript:
local Character = script.Parent
local Player = game.Players.LocalPlayer
local Humanoid = Character:WaitForChild("Humanoid")
local Animation = Instance.new("Animation")
Animation.Name = "CustomDance"
local emote = ""
function Emote()
if emote == "dance4" then
Animation.AnimationId = "rbxassetid://4849366774"
--Animation.Looped = true
local animationTrack = Humanoid:LoadAnimation(Animation)
animationTrack:Play()
elseif emote == "justice" then
Animation.AnimationId = "rbxassetid://4849331061"
--Animation.Looped = true
local animationTrack = Humanoid:LoadAnimation(Animation)
animationTrack:Play()
end
end
function StopAnims()
local ActiveTracks = Humanoid:GetPlayingAnimationTracks()
for _,v in pairs(ActiveTracks) do
if v.Name == "CustomDance" then
v:Stop()
end
end
end
Player.Chatted:Connect(function(msg)
if (string.sub(msg, 1, 3) == "/e ") then
emote = string.sub(msg, 4)
Emote()
elseif (string.sub(msg, 1, 7) == "/emote ") then
emote = string.sub(msg, 8)
Emote()
end
end)
Humanoid.Died:Connect(StopAnims())
Humanoid.Running:Connect(StopAnims())
Humanoid.Jumping:Connect(StopAnims())
Humanoid.Climbing:Connect(StopAnims())
Humanoid.GettingUp:Connect(StopAnims())
Humanoid.FreeFalling:Connect(StopAnims())
Humanoid.FallingDown:Connect(StopAnims())
Humanoid.Seated:Connect(StopAnims())
Humanoid.PlatformStanding:Connect(StopAnims())
Humanoid.Swimming:Connect(StopAnims())

1 comment
Did you try removing the brackets when connecting? (not all just the extra ones)