I made a script with emotes. For example if you type /hands then an animation plays. What I want is that if the character says /hands again then the animation stops. Please help :)
Code:
local players = game:GetService("Players")
local command1 = "/hands"
function onChatted(chat, recipent, speaker)
local name = speaker.Name
chat = string.lower(chat)
if (chat == command1) then
local player = players:FindFirstChild(name)
local Humanoid = player.Character.Humanoid
local ActiveTracks = Humanoid:GetPlayingAnimationTracks()
for _,v in pairs(ActiveTracks) do
v:Stop()
end
end
function onPlayerEntered(player)
player.Chatted:Connect(function(chat,recipent) onChatted(chat,recipent,player) end)
end
game.Players.PlayerAdded:Connect(onPlayerEntered)
Thank you for taking your time!
