Emote freezer
Key RequiredUniversal

Emote freezer

Universal Scriptbusya8488busya8488 752 views 485 executesUpdated Aug 10, 2026
Unrated
00
Lua Script•299 lines (9089 chars)
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")

local player = Players.LocalPlayer

-- Удаляем старую кнопку, если она уже была создана ранее
for _, oldGui in ipairs({player:FindFirstChild("PlayerGui"), game:GetService("CoreGui")}) do
    if oldGui then
        local existing = oldGui:FindFirstChild("FreezeAnimGui_Ultra")
        if existing then existing:Destroy() end
    end
end

-- ================= 1. МГНОВЕННОЕ СОЗДАНИЕ КНОПКИ =================
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "FreezeAnimGui_Ultra"
screenGui.ResetOnSpawn = false
screenGui.DisplayOrder = 999999

-- Самый надежный метод добавления GUI на экран
local targetParent = nil
if gethui then
    pcall(function() targetParent = gethui() end)
end
if not targetParent then
    pcall(function() targetParent = game:GetService("CoreGui") end)
end
if not targetParent then
    targetParent = player:WaitForChild("PlayerGui", 3) or player:FindFirstChildOfClass("PlayerGui")
end

screenGui.Parent = targetParent

local toggleBtn = Instance.new("TextButton")
toggleBtn.Name = "FreezeBtn"
toggleBtn.Size = UDim2.new(0, 150, 0, 50)
-- Позиция: Центр экрана в верхней части
toggleBtn.Position = UDim2.new(0.5, -75, 0.15, 0)
toggleBtn.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
toggleBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
toggleBtn.Text = "❄️ Заморозить"
toggleBtn.Font = Enum.Font.SourceSansBold
toggleBtn.TextSize = 16
toggleBtn.Active = true
toggleBtn.Draggable = true
toggleBtn.ZIndex = 1000
toggleBtn.Parent = screenGui

local UICorner = Instance.new("UICorner")
UICorner.CornerRadius = UDim.new(0, 10)
UICorner.Parent = toggleBtn

local UIStroke = Instance.new("UIStroke")
UIStroke.Thickness = 2
UIStroke.Color = Color3.fromRGB(0, 170, 255)
UIStroke.Parent = toggleBtn
-- =================================================================

-- ================= 2. ЛОГИКА ЗАМОРОЗКИ =================
local lastPlayedTrack = nil
local frozenTrack = nil
local frozenTime = 0
local isFrozen = false
local heartbeatConnection = nil
local animConnections = {}

local ignoredWords = {"walk", "run", "idle", "jump", "fall", "swim", "climb", "strafe"}

local function getHumanoid()
    local char = player.Character
    return char and char:FindFirstChildOfClass("Humanoid")
end

local function isMovementAnim(track)
    if not track then return false end
    local name = string.lower(track.Name or "")
    for _, word in ipairs(ignoredWords) do
        if string.find(name, word) then
            return true
        end
    end
    return false
end

local function isSameAnimation(track1, track2)
    if not track1 or not track2 then return false end
    if track1 == track2 then return true end
    
    local id1 = track1.Animation and track1.Animation.AnimationId
    local id2 = track2.Animation and track2.Animation.AnimationId
    return (id1 and id2 and id1 ~= "" and id1 == id2)
end

local function hookAnimator(targetAnimator)
    if not targetAnimator then return end
    local conn = targetAnimator.AnimationPlayed:Connect(function(track)
        if not isFrozen and not isMovementAnim(track) then
            lastPlayedTrack = track
        end
    end)
    table.insert(animConnections, conn)
end

local function setupAllAnimatorsHook()
    for _, conn in ipairs(animConnections) do pcall(function() conn:Disconnect() end) end
    animConnections = {}
    
    local char = player.Character
    if not char then return end
    
    local hum = char:FindFirstChildOfClass("Humanoid")
    if hum then
        local conn = hum.EmotePlayed:Connect(function(_, track)
            if not isFrozen and track then
                lastPlayedTrack = track
            end
        end)
        table.insert(animConnections, conn)
    end
    
    for _, obj in ipairs(char:GetDescendants()) do
        if obj:IsA("Animator") then
            hookAnimator(obj)
        end
    end
    
    local addConn = char.DescendantAdded:Connect(function(obj)
        if obj:IsA("Animator") then
            hookAnimator(obj)
        end
    end)
    table.insert(animConnections, addConn)
end

task.spawn(setupAllAnimatorsHook)

player.CharacterAdded:Connect(function()
    task.wait(0.5)
    setupAllAnimatorsHook()
    if isFrozen then
        isFrozen = false
        frozenTrack = nil
        toggleBtn.Text = "❄️ Заморозить"
        toggleBtn.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
    end
end)

local function getActiveTrack()
    if lastPlayedTrack and (lastPlayedTrack.IsPlaying or lastPlayedTrack.TimePosition > 0) then
        return lastPlayedTrack
    end
    
    local char = player.Character
    if not char then return nil end
    
    local allTracks = {}
    for _, obj in ipairs(char:GetDescendants()) do
        if obj:IsA("Animator") or obj:IsA("Humanoid") or obj:IsA("AnimationController") then
            pcall(function()
                for _, trk in ipairs(obj:GetPlayingAnimationTracks()) do
                    table.insert(allTracks, trk)
                end
            end)
        end
    end
    
    for i = #allTracks, 1, -1 do
        local trk = allTracks[i]
        if trk.IsPlaying and not isMovementAnim(trk) then
            return trk
        end
    end
    
    for i = #allTracks, 1, -1 do
        local trk = allTracks[i]
        if trk.IsPlaying then
            return trk
        end
    end
    
    return nil
end

local function toggleFreeze()
    local char = player.Character
    local hum = getHumanoid()
    if not char or not hum then return end
    
    if not isFrozen then
        local targetTrack = getActiveTrack()
        
        if not targetTrack then
            local oldText = toggleBtn.Text
            toggleBtn.Text = "❌ Включи эмоцию!"
            toggleBtn.BackgroundColor3 = Color3.fromRGB(220, 100, 0)
            
            task.delay(1.5, function()
                if not isFrozen then
                    toggleBtn.Text = oldText
                    toggleBtn.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
                end
            end)
            return
        end
        
        frozenTrack = targetTrack
        frozenTime = frozenTrack.TimePosition
        if frozenTime <= 0 then frozenTime = 0.1 end
        
        isFrozen = true
        
        pcall(function()
            frozenTrack.Priority = Enum.AnimationPriority.Action4
        end)
        
        local animateScript = char:FindFirstChild("Animate")
        if animateScript then
            animateScript.Disabled = true
        end
        
        for _, obj in ipairs(char:GetDescendants()) do
            if obj:IsA("Animator") or obj:IsA("Humanoid") or obj:IsA("AnimationController") then
                pcall(function()
                    for _, trk in ipairs(obj:GetPlayingAnimationTracks()) do
                        if not isSameAnimation(trk, frozenTrack) then
                            trk:Stop(0)
                        end
                    end
                end)
            end
        end
        
        frozenTrack:AdjustSpeed(0)
        frozenTrack.TimePosition = frozenTime
        
        toggleBtn.Text = "🔥 Разморозить"
        toggleBtn.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
        
        if heartbeatConnection then heartbeatConnection:Disconnect() end
        heartbeatConnection = RunService.Heartbeat:Connect(function()
            if not isFrozen or not frozenTrack then return end
            
            pcall(function()
                if not frozenTrack.IsPlaying then
                    frozenTrack:Play(0, 1, 0)
                end
                frozenTrack:AdjustSpeed(0)
                frozenTrack.TimePosition = frozenTime
            end)
            
            if hum then
                hum.PlatformStand = false
                hum.Sit = false
                if hum.WalkSpeed == 0 then
                    hum.WalkSpeed = 16
                end
            end
        end)
    else
        if heartbeatConnection then
            heartbeatConnection:Disconnect()
            heartbeatConnection = nil
        end
        
        if frozenTrack then
            pcall(function()
                frozenTrack:AdjustSpeed(1)
                frozenTrack:Stop(0)
            end)
            frozenTrack = nil
        end
        
        local animateScript = char:FindFirstChild("Animate")
        if animateScript then
            animateScript.Disabled = false
        end
        
        isFrozen = false
        toggleBtn.Text = "❄️ Заморозить"
        toggleBtn.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
    end
end

toggleBtn.MouseButton1Click:Connect(toggleFreeze)

UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if gameProcessed then return end
    if input.KeyCode == Enum.KeyCode.G then
        toggleFreeze()
    end
end)

UserInputService.JumpRequest:Connect(function()
    local hum = getHumanoid()
    if isFrozen and hum and hum.FloorMaterial ~= Enum.Material.Air then
        hum.Jump = true
    end
end)

Features & Information

Скрипт сделан мной и гемими пока я его делал я съел:2 творожка даниссимо / script by Gemimi and me FE
#FE

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts