local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local UserInputService = game:GetService("UserInputService") local player = Players.LocalPlayer local animIds = { disappointed = 127127301623607, talking = 102660197471249, confused = 95423461594514, thinking = 124700712437062, confused2 = 120130738295519, pointing = 82179945186939, wave = 116146360657398, rareWave = 83988109664343, typingAnims = { 133354554898821, 125737937926329, 123167401858016, 110229897282599, 96513369166239, } } local activeTrack = nil local function stopCurrent() if activeTrack and activeTrack.IsPlaying then activeTrack:Stop() end end local function playAnimation(char, animId, duration, looped) stopCurrent() local humanoid = char:FindFirstChildOfClass("Humanoid") if not humanoid then return end local animator = humanoid:FindFirstChildOfClass("Animator") or Instance.new("Animator") animator.Parent = humanoid local animation = Instance.new("Animation") animation.AnimationId = "rbxassetid://" .. animId local track = animator:LoadAnimation(animation) track.Priority = Enum.AnimationPriority.Action4 track.Looped = looped or false track:Play() if looped then track:AdjustSpeed(0.6) end activeTrack = track if duration then task.delay(duration, function() if track and track.IsPlaying then track:Stop() end end) end humanoid.Running:Connect(function(speed) if speed > 0.5 then stopCurrent() end end) end UserInputService.TextBoxFocused:Connect(function() if player.Character then local randomAnim = animIds.typingAnims[math.random(1, #animIds.typingAnims)] playAnimation(player.Character, randomAnim, nil, true) end end) UserInputService.TextBoxFocusReleased:Connect(function() stopCurrent() end) player.Chatted:Connect(function(message) if not player.Character then return end if message:find("%.") then stopCurrent() return end local lower = message:lower() if (lower:find("hi") or lower:find("hey") or lower:find("heyo")) and (message:match("[%p]") or message:match("[^%w%s]")) then playAnimation(player.Character, animIds.rareWave, 3) elseif lower:find("bruh") then playAnimation(player.Character, animIds.disappointed, 3) elseif lower:find("i don't know") or lower:find("idk") then playAnimation(player.Character, animIds.confused2, 3) elseif lower:find("%?") then playAnimation(player.Character, animIds.confused, 1.5) elseif lower:match("^hm+$") or lower:find("%f[%w]hm+%f[%W]") then playAnimation(player.Character, animIds.thinking, 3) elseif lower:find("look") or lower:find("this way") or lower:find("that way") or lower:find("over there") then playAnimation(player.Character, animIds.pointing, 2) elseif lower:find("hello") or lower:find("hi") or lower:find("heyo") or lower:find("hey") or lower:find("sup") or lower:find("yo") then playAnimation(player.Character, animIds.wave, 3) elseif #message > 35 then playAnimation(player.Character, animIds.talking, 4) end end)