Controller pro Nullvector
Key RequiredUniversal

Controller pro Nullvector

Universal ScriptNullvectorNullvector 205 views 4 executesUpdated Feb 2, 2026
Unrated
00
Lua Script•135 lines (4654 chars)
--// Custom Animation Controller Pro (Som de Caminhada + Som de Dormir)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")

local player = Players.LocalPlayer
local lastActivity = tick()
local isAfk = false
local canDash = true
local isDashing = false

--// IDs DE ANIMAÇÃO E SOM
local ANIMS_DATA = {
    Idle = "rbxassetid://72134715166180",    
    Walk = "rbxassetid://114722309053999",   
    AfkLoop = "rbxassetid://105410450070122", 
    Dash = "rbxassetid://522635514",         
}

local SOUND_DORMIR = "rbxassetid://114376757380093" -- Menu Theme
local SOUND_WALK   = "rbxassetid://596046130"       -- Flying Sound FX
local SOUND_NORMAL = "rbxassetid://1836935697"      -- Test Facility

local humanoid, animator, rootPart
local tracks = {}
local sfxDormir, sfxWalk, sfxNormal

--// SETUP DE PERSONAGEM E SONS
local function setupCharacter(char)
    humanoid = char:WaitForChild("Humanoid")
    animator = humanoid:WaitForChild("Animator")
    rootPart = char:WaitForChild("HumanoidRootPart")

    -- Criar os objetos de som
    local function createSound(id, name, looped)
        local s = Instance.new("Sound", rootPart)
        s.Name = name
        s.SoundId = id
        s.Looped = looped
        s.Volume = 0.5
        return s
    end

    sfxDormir = createSound(SOUND_DORMIR, "SleepSound", true)
    sfxWalk   = createSound(SOUND_WALK, "WalkSound", true)
    sfxNormal = createSound(SOUND_NORMAL, "NormalSound", true)

    -- Carregar Animações
    for _, t in pairs(tracks) do t:Stop() t:Destroy() end
    tracks = {}
    for name, id in pairs(ANIMS_DATA) do
        local anim = Instance.new("Animation")
        anim.AnimationId = id
        local track = animator:LoadAnimation(anim)
        track.Priority = (name == "Dash") and Enum.AnimationPriority.Action4 or (name == "AfkLoop" and Enum.AnimationPriority.Action or Enum.AnimationPriority.Movement)
        tracks[name] = track
    end
end

local function playSmoothly(name, fadeTime)
    fadeTime = fadeTime or 0.5
    if tracks[name] and not tracks[name].IsPlaying then
        if isDashing and name ~= "Dash" then return end
        for n, t in pairs(tracks) do if n ~= name then t:Stop(fadeTime) end end
        tracks[name]:Play(fadeTime)
    end
end

--// SISTEMA DE DASH
local function createDashSystem()
    local sg = Instance.new("ScreenGui", player.PlayerGui)
    sg.Name = "DashGuiPro"
    local btn = Instance.new("TextButton", sg)
    btn.Size = UDim2.new(0, 70, 0, 70)
    btn.Position = UDim2.new(0.75, 0, 0.45, 0)
    btn.Text = "DASH"
    btn.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
    btn.TextColor3 = Color3.new(1,1,1)
    btn.Draggable = true
    Instance.new("UICorner", btn).CornerRadius = UDim.new(0.5, 0)
    Instance.new("UIStroke", btn).Color = Color3.fromRGB(0, 170, 255)

    btn.MouseButton1Click:Connect(function()
        if canDash and not isDashing then
            canDash = false; isDashing = true; lastActivity = tick()
            local bv = Instance.new("BodyVelocity", rootPart)
            bv.MaxForce = Vector3.new(1e5, 0, 1e5); bv.Velocity = rootPart.CFrame.LookVector * 55 
            playSmoothly("Dash", 0.1)
            task.wait(0.9)
            bv:Destroy(); isDashing = false
            task.wait(2); canDash = true
        end
    end)
end

--// LÓGICA DE MOVIMENTO E SONS
RunService.RenderStepped:Connect(function()
    if not humanoid or humanoid.Health <= 0 then return end
    local moveSpeed = humanoid.MoveDirection.Magnitude
    local now = tick()

    if moveSpeed > 0.1 or isDashing then
        lastActivity = now
        if isAfk then
            isAfk = false
            tracks.AfkLoop:Stop(0.5)
            sfxDormir:Stop()
        end
        
        if not isDashing then
            playSmoothly("Walk", 0.3)
            -- Controle de Sons ao mover
            if not sfxWalk.IsPlaying then sfxWalk:Play() end
            if not sfxNormal.IsPlaying then sfxNormal:Play() end
        end
    else
        -- Parado
        sfxWalk:Stop()
        if now - lastActivity >= 60 then 
            if not isAfk then
                isAfk = true
                playSmoothly("AfkLoop", 0.8)
                sfxDormir:Play()
                sfxNormal:Stop() -- Para a música normal para dormir
            end
        else
            if not isAfk and not isDashing then playSmoothly("Idle", 0.5) end
        end
    end
end)

if player.Character then setupCharacter(player.Character) end
player.CharacterAdded:Connect(setupCharacter)
createDashSystem()

Features & Information

None

Community Comments (1)

aabysstiigeerqaabysstiigeerqFeb 2, 2026

w

More Scripts for Universal Scripts