Global Animations Sync by me
Key RequiredUniversal

Global Animations Sync by me

Universal ScriptIrfannnnnIrfannnnn 2.1K views 231 executesUpdated Jan 25, 2026
5.0/ 5(2 votes)
20100% Positive
Lua Script•335 lines (13939 chars)
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local CoreGui = game:GetService("CoreGui")
local StarterGui = game:GetService("StarterGui")

local LocalPlayer = Players.LocalPlayer
local Camera = workspace.CurrentCamera
local MaxDistance = 15
local UiHideDistance = 15

local ScriptConnections = {}
local State = {
    SyncedTarget = nil,
    CurrentGui = nil,
    CurrentSelection = nil,
    AnimationTracks = {},
    ConfirmLoop = nil 
}

local Highlight = Instance.new("Highlight")
Highlight.FillColor = Color3.fromRGB(255, 255, 255)
Highlight.OutlineColor = Color3.fromRGB(255, 0, 0)
Highlight.FillTransparency = 0.5
Highlight.OutlineTransparency = 0

local BlockedKeywords = {
    "walk", "run", "fall", "jump", "climb", "swim", 
    "float", "straf", "pose", "loop", 
    "tool", "equip", "lunge", "slash" 
}

local function Notify(title, text)
    pcall(function()
        StarterGui:SetCore("SendNotification", {
            Title = title, Text = text, Duration = 5, Button1 = "OK!"
        })
    end)
end

local function GetRigType(char)
    if not char then return nil end
    local hum = char:FindFirstChildOfClass("Humanoid")
    return hum and hum.RigType
end

local function ToggleLocalAnimate(enabled)
    local char = LocalPlayer.Character
    if not char then return end
    local animate = char:FindFirstChild("Animate")
    if animate and animate:IsA("LocalScript") then
        animate.Disabled = not enabled
    end
    if not enabled then
        local humanoid = char:FindFirstChildOfClass("Humanoid")
        if humanoid then
            for _, track in ipairs(humanoid:GetPlayingAnimationTracks()) do
                track:Stop(0.1)
            end
        end
    end
end

local function TerminateScript()
    if ScriptConnections.SyncLoop then ScriptConnections.SyncLoop:Disconnect() end
    if ScriptConnections.InputListener then ScriptConnections.InputListener:Disconnect() end
    if ScriptConnections.DistanceMonitor then ScriptConnections.DistanceMonitor:Disconnect() end
    ToggleLocalAnimate(true)
    if Highlight.Parent then Highlight.Parent = nil end
    Highlight:Destroy()
    if State.CurrentGui then State.CurrentGui:Destroy() end
    for _, track in pairs(State.AnimationTracks) do
        if track then track:Stop(0) end
    end
    table.clear(State.AnimationTracks)
    table.clear(State)
    table.clear(ScriptConnections)
end

local function CleanupVisuals()
    if ScriptConnections.DistanceMonitor then ScriptConnections.DistanceMonitor:Disconnect() ScriptConnections.DistanceMonitor = nil end
    if Highlight.Parent then Highlight.Parent = nil end
    if State.CurrentGui then State.CurrentGui:Destroy() State.CurrentGui = nil end
    State.CurrentSelection = nil
end

local function StopSyncLogicOnly()
    if ScriptConnections.SyncLoop then ScriptConnections.SyncLoop:Disconnect() ScriptConnections.SyncLoop = nil end
    ToggleLocalAnimate(true)
    for _, track in pairs(State.AnimationTracks) do
        track:Stop(0.1)
    end
    table.clear(State.AnimationTracks)
    State.SyncedTarget = nil
end

local function GetCharacter(descendant)
    if not descendant then return nil end
    if descendant:IsA("Model") and descendant:FindFirstChildOfClass("Humanoid") then
        return descendant
    elseif descendant.Parent then
        return GetCharacter(descendant.Parent)
    end
    return nil
end

local function IsMovementAnimation(track)
    if track.Priority == Enum.AnimationPriority.Movement then return true end
    local name = track.Name:lower()
    local animName = (track.Animation and track.Animation.Name:lower()) or ""
    for _, keyword in ipairs(BlockedKeywords) do
        if string.find(name, keyword) or string.find(animName, keyword) then
            return true
        end
    end
    if track.Priority == Enum.AnimationPriority.Idle then
        if name == "idle" or name == "animation" or name == "animation1" then
            return true
        end
    end
    return false
end

local function SyncLoopStep()
    if not State.SyncedTarget or not State.SyncedTarget.Parent or not State.SyncedTarget:FindFirstChildOfClass("Humanoid") then
        StopSyncLogicOnly()
        return
    end
    local TargetHumanoid = State.SyncedTarget:FindFirstChildOfClass("Humanoid")
    local LocalHumanoid = LocalPlayer.Character and LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
    if not LocalHumanoid then return end
    local TargetAnimator = TargetHumanoid:FindFirstChildOfClass("Animator")
    local LocalAnimator = LocalHumanoid:FindFirstChildOfClass("Animator")
    if not TargetAnimator or not LocalAnimator then return end
    local ActiveTracks = TargetAnimator:GetPlayingAnimationTracks()
    local ActiveIDs = {}
    for _, TargetTrack in ipairs(ActiveTracks) do
        if not IsMovementAnimation(TargetTrack) then
            local AnimId = TargetTrack.Animation.AnimationId
            if AnimId and #AnimId > 0 then
                ActiveIDs[AnimId] = true 
                if not State.AnimationTracks[AnimId] then
                    local NewAnim = Instance.new("Animation")
                    NewAnim.AnimationId = AnimId
                    local LocalTrack = LocalAnimator:LoadAnimation(NewAnim)
                    LocalTrack.Priority = Enum.AnimationPriority.Action4 
                    LocalTrack:Play(0.1, 1, TargetTrack.Speed)
                    State.AnimationTracks[AnimId] = LocalTrack
                end
                local LocalTrack = State.AnimationTracks[AnimId]
                if LocalTrack then
                    -- === HARD SYNC FOR EXACT REPLICATION ===
                    LocalTrack.Looped = TargetTrack.Looped
                    LocalTrack:AdjustWeight(TargetTrack.WeightTarget, 0) -- Instant weight
                    LocalTrack:AdjustSpeed(TargetTrack.Speed)
                    LocalTrack.TimePosition = TargetTrack.TimePosition -- Force time position
                end
            end
        end
    end
    for Id, LocalTrack in pairs(State.AnimationTracks) do
        if not ActiveIDs[Id] then
            LocalTrack:Stop(0.1)
            State.AnimationTracks[Id] = nil
        end
    end
end

local function CreateUI(TargetModel)
    if State.CurrentGui then State.CurrentGui:Destroy() end
    local Gui = Instance.new("BillboardGui")
    Gui.Name = "ExploitUI_Controller"
    Gui.Adornee = TargetModel:FindFirstChild("HumanoidRootPart") or TargetModel:FindFirstChild("Head")
    Gui.Size = UDim2.new(0, 300, 0, 70)
    Gui.StudsOffset = Vector3.new(0, 3.5, 0)
    Gui.AlwaysOnTop = true
    Gui.Active = true
    local MainFrame = Instance.new("Frame")
    MainFrame.Size = UDim2.new(1, 0, 1, 0)
    MainFrame.BackgroundTransparency = 1
    MainFrame.Parent = Gui
    local MainPage = Instance.new("Frame")
    MainPage.Name = "MainPage"
    MainPage.Size = UDim2.new(1, 0, 1, 0)
    MainPage.BackgroundTransparency = 1
    MainPage.Visible = true
    MainPage.Parent = MainFrame
    local ConfirmPage = Instance.new("Frame")
    ConfirmPage.Name = "ConfirmPage"
    ConfirmPage.Size = UDim2.new(1, 0, 1, 0)
    ConfirmPage.BackgroundTransparency = 1
    ConfirmPage.Visible = false
    ConfirmPage.Parent = MainFrame
    local MainLayout = Instance.new("UIListLayout")
    MainLayout.FillDirection = Enum.FillDirection.Horizontal
    MainLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
    MainLayout.VerticalAlignment = Enum.VerticalAlignment.Center
    MainLayout.Padding = UDim.new(0, 5)
    MainLayout.Parent = MainPage
    local ConfirmLayout = Instance.new("UIListLayout")
    ConfirmLayout.FillDirection = Enum.FillDirection.Horizontal
    ConfirmLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
    ConfirmLayout.VerticalAlignment = Enum.VerticalAlignment.Center
    ConfirmLayout.Padding = UDim.new(0, 5)
    ConfirmLayout.Parent = ConfirmPage
    local function CreateButton(Parent, Text, Color, SizeX)
        local Btn = Instance.new("TextButton")
        Btn.Text = Text
        Btn.Size = UDim2.new(0, SizeX, 0, 40)
        Btn.BackgroundColor3 = Color
        Btn.TextColor3 = Color3.new(1, 1, 1)
        Btn.Font = Enum.Font.GothamBold
        Btn.TextSize = 14
        Btn.AutoButtonColor = true
        Btn.Parent = Parent
        local Corner = Instance.new("UICorner")
        Corner.CornerRadius = UDim.new(0, 6)
        Corner.Parent = Btn
        local Stroke = Instance.new("UIStroke")
        Stroke.Thickness = 1.5
        Stroke.Color = Color3.new(0, 0, 0)
        Stroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
        Stroke.Parent = Btn
        return Btn
    end
    local SyncBtn = CreateButton(MainPage, "Sync Animation", Color3.fromRGB(0, 170, 255), 110)
    local CloseXBtn = CreateButton(MainPage, "X", Color3.fromRGB(255, 60, 60), 40)
    local UnsyncBtn = CreateButton(MainPage, "Unsync", Color3.fromRGB(255, 170, 0), 110)
    local YesBtn = CreateButton(ConfirmPage, "YES (3s)", Color3.fromRGB(150, 150, 150), 125)
    local NoBtn = CreateButton(ConfirmPage, "NO", Color3.fromRGB(255, 50, 50), 125)
    local CanClickYes = false
    if State.SyncedTarget == TargetModel then SyncBtn.Text = "Synced" end
    SyncBtn.MouseButton1Click:Connect(function()
        if State.SyncedTarget == TargetModel then return end
        if State.SyncedTarget then StopSyncLogicOnly() end
        ToggleLocalAnimate(false)
        State.SyncedTarget = TargetModel
        SyncBtn.Text = "Synced"
        ScriptConnections.SyncLoop = RunService.RenderStepped:Connect(SyncLoopStep)
    end)
    UnsyncBtn.MouseButton1Click:Connect(function()
        if State.SyncedTarget then
            StopSyncLogicOnly()
            SyncBtn.Text = "Sync Animation"
        end
    end)
    CloseXBtn.MouseButton1Click:Connect(function()
        MainPage.Visible = false
        ConfirmPage.Visible = true
        CanClickYes = false
        YesBtn.BackgroundColor3 = Color3.fromRGB(150, 150, 150)
        YesBtn.Text = "YES (3s)"
        local Token = tick()
        State.ConfirmLoop = Token
        task.spawn(function()
            for i = 3, 1, -1 do
                if State.ConfirmLoop ~= Token or not Gui.Parent then return end
                YesBtn.Text = "YES ("..i.."s)"
                task.wait(1)
            end
            if State.ConfirmLoop == Token and Gui.Parent and ConfirmPage.Visible then
                YesBtn.Text = "YES"
                YesBtn.BackgroundColor3 = Color3.fromRGB(0, 200, 100)
                CanClickYes = true
            end
        end)
    end)
    NoBtn.MouseButton1Click:Connect(function()
        State.ConfirmLoop = nil 
        ConfirmPage.Visible = false
        MainPage.Visible = true
    end)
    YesBtn.MouseButton1Click:Connect(function()
        if CanClickYes then TerminateScript() end
    end)
    local parent = CoreGui or LocalPlayer:WaitForChild("PlayerGui")
    Gui.Parent = parent
    State.CurrentGui = Gui
    ScriptConnections.DistanceMonitor = RunService.RenderStepped:Connect(function()
        local MyHRP = LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
        local TargetHRP = TargetModel and TargetModel.Parent and TargetModel:FindFirstChild("HumanoidRootPart")
        if MyHRP and TargetHRP then
            if (MyHRP.Position - TargetHRP.Position).Magnitude > UiHideDistance then
                CleanupVisuals()
            end
        else
            CleanupVisuals()
        end
    end)
end

ScriptConnections.InputListener = UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if input.UserInputType == Enum.UserInputType.MouseButton1 and not gameProcessed then
        local MouseLocation = UserInputService:GetMouseLocation()
        local RayOrigin = Camera:ViewportPointToRay(MouseLocation.X, MouseLocation.Y)
        local RayParams = RaycastParams.new()
        RayParams.FilterType = Enum.RaycastFilterType.Exclude
        RayParams.FilterDescendantsInstances = {LocalPlayer.Character}
        local Result = workspace:Raycast(RayOrigin.Origin, RayOrigin.Direction * 2000, RayParams)
        local DidSelect = false
        if Result and Result.Instance then
            local HitChar = GetCharacter(Result.Instance)
            if HitChar and HitChar ~= LocalPlayer.Character then
                local MyHRP = LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
                if MyHRP and (Result.Position - MyHRP.Position).Magnitude <= MaxDistance then
                    local LocalRig = GetRigType(LocalPlayer.Character)
                    local TargetRig = GetRigType(HitChar)
                    if LocalRig == TargetRig then
                        DidSelect = true
                        if State.CurrentSelection ~= HitChar then
                            CleanupVisuals()
                            State.CurrentSelection = HitChar
                            Highlight.Adornee = HitChar
                            Highlight.Parent = HitChar
                            CreateUI(HitChar)
                        elseif State.CurrentGui == nil then
                            CleanupVisuals()
                            State.CurrentSelection = HitChar
                            Highlight.Adornee = HitChar
                            Highlight.Parent = HitChar
                            CreateUI(HitChar)
                        end
                    else
                        local RigName = (TargetRig == Enum.HumanoidRigType.R6 and "R6" or "R15")
                        Notify("Incompatible Rig", "Your RigType does not match the target's ("..RigName..").")
                        CleanupVisuals()
                    end
                end
            end
        end
        if not DidSelect then CleanupVisuals() end
    end
end)

Notify("Global Animations Sync V1 Loaded", "Click any targets to sync (R6/R15 supported).")

Features & Information

Click any targets to sync. Can be Humanoid NPCs or Players. Originally by me (Botakkkkk) Features: - Supports R6 & R15 Animations/Emotes. - Close Button with Confirmation. (Note: It will warn you if you in different rigtype like the animation from an NPC is R6, but you're in R15, it will show warning notification) Q: Is it FE? A: IDK, i don't have friends to test the script with me. Q: Is it AI script? A: Yes, i'm just a skidder, idc. Q: Is it Open Source? A: Yes, it is.
#globalanimationssync#animationssync#animations#sync

Community Comments (2)

BenfromrobloxBenfromrobloxFeb 20, 2026

yo i can be your friend to test out fe script

yutzzyutzzFeb 22, 2026

mau test bareng bang?

More Scripts for Universal Scripts