local plr = game.Players.LocalPlayer local UserInputService = game:GetService("UserInputService") local SoundService = game:GetService("SoundService") local Debris = game:GetService("Debris") local CONFIG = { StartAnimation = "rbxassetid://74358763366120", LoopAnimation = "rbxassetid://94915955533070", StartSound = "rbxassetid://118415112024805", LoopSound = "rbxassetid://127575451203432", StartDuration = 6.7, LoopSoundInterval = 5.1, Volume = 2.5 } local emoteActive = false local animTrackStart = nil local animTrackLoop = nil local soundStart = nil local soundLoop = nil local loopConnection = nil local emoteStopped = false local emoteRemoved = false local connections = {} local function AddConnection(conn) table.insert(connections, conn) end local function RemoveAllConnections() for _, conn in ipairs(connections) do pcall(function() conn:Disconnect() end) end connections = {} end local function StopEmote() emoteStopped = true emoteActive = false if animTrackStart then pcall(function() animTrackStart:Stop() end) animTrackStart = nil end if animTrackLoop then pcall(function() animTrackLoop:Stop() end) animTrackLoop = nil end if soundStart then pcall(function() soundStart:Stop(); soundStart:Destroy() end) soundStart = nil end if soundLoop then pcall(function() soundLoop:Stop(); soundLoop:Destroy() end) soundLoop = nil end if loopConnection then pcall(function() loopConnection:Disconnect() end) loopConnection = nil end end local function PlayEmote() if emoteRemoved then return end local char = plr.Character if not char then return end local humanoid = char:FindFirstChild("Humanoid") if not humanoid then return end if emoteActive then StopEmote() task.wait(0.2) end emoteStopped = false emoteActive = true for _, track in pairs(humanoid:GetPlayingAnimationTracks()) do pcall(function() track:Stop() end) end local animStart = Instance.new("Animation") animStart.AnimationId = CONFIG.StartAnimation animTrackStart = humanoid:LoadAnimation(animStart) if animTrackStart then animTrackStart:Play() end soundStart = Instance.new("Sound") soundStart.SoundId = CONFIG.StartSound soundStart.Parent = char soundStart.Volume = CONFIG.Volume soundStart:Play() task.delay(CONFIG.StartDuration + 0.5, function() if soundStart then pcall(function() soundStart:Stop(); soundStart:Destroy() end) soundStart = nil end end) task.delay(CONFIG.StartDuration, function() if emoteStopped or not emoteActive or emoteRemoved then return end if animTrackStart then pcall(function() animTrackStart:Stop() end) animTrackStart = nil end local animLoop = Instance.new("Animation") animLoop.AnimationId = CONFIG.LoopAnimation animTrackLoop = humanoid:LoadAnimation(animLoop) if animTrackLoop then animTrackLoop:Play() end local function PlayLoopSound() if emoteStopped or not emoteActive or emoteRemoved then return end soundLoop = Instance.new("Sound") soundLoop.SoundId = CONFIG.LoopSound soundLoop.Parent = char soundLoop.Volume = CONFIG.Volume soundLoop:Play() Debris:AddItem(soundLoop, 5) if not emoteStopped and emoteActive and not emoteRemoved then loopConnection = task.delay(CONFIG.LoopSoundInterval, PlayLoopSound) end end PlayLoopSound() end) end local inputConn = UserInputService.InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if input.KeyCode == Enum.KeyCode.C then PlayEmote() end if input.KeyCode == Enum.KeyCode.X then StopEmote() end if input.KeyCode == Enum.KeyCode.F4 then if emoteRemoved then return end emoteRemoved = true StopEmote() RemoveAllConnections() inputConn:Disconnect() end end) AddConnection(inputConn) local charConn = plr.CharacterAdded:Connect(function() StopEmote() end) AddConnection(charConn)