Sonic CD Special Stage Sonic
Key RequiredUniversal

Sonic CD Special Stage Sonic

Universal ScriptTheCoolMakuhTheCoolMakuh 1.3K views 151 executesUpdated Mar 30, 2026
Unrated
00
Lua Script•101 lines (3272 chars)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer

local function initSonic(char)
    task.wait(0.5) 
    local hum = char:WaitForChild("Humanoid")
    local root = char:WaitForChild("HumanoidRootPart")
    
    if root:FindFirstChild("SonicRoot") then root.SonicRoot:Destroy() end

    -- Momentum & Stats
    local topSpeed = 38 
    local accel = 14
    local friction = 35
    local currentVel = 0
    
    local sprites = {
        idle = "rbxassetid://98630909487817",
        walk = {"rbxassetid://100186283005430", "rbxassetid://74520657580881", "rbxassetid://121565656917719"},
        run = {"rbxassetid://132396712896037", "rbxassetid://139692518360487", "rbxassetid://93868266127173", "rbxassetid://117677156233751"},
        jump = {"rbxassetid://118861123713099", "rbxassetid://76937403052942", "rbxassetid://130530288388496"}
    }

    local function hide()
        for _, v in pairs(char:GetDescendants()) do
            if (v:IsA("BasePart") and v.Name ~= "HumanoidRootPart") or v:IsA("Decal") then
                v.Transparency = 1
            end
        end
    end
    hide()
    char.DescendantAdded:Connect(hide)

    local main = Instance.new("BillboardGui")
    main.Name = "SonicRoot"
    main.Size = UDim2.new(5, 0, 5, 0)
    main.Adornee = root
    main.AlwaysOnTop = false 
    main.ExtentsOffset = Vector3.new(0, 0.8, 0) 
    
    local img = Instance.new("ImageLabel")
    img.Size = UDim2.new(1, 0, 1, 0)
    img.BackgroundTransparency = 1
    img.ResampleMode = Enum.ResamplerMode.Pixelated
    -- FIX: This prevents the "stretched" look
    img.ScaleType = Enum.ScaleType.Fit 
    img.Parent = main
    main.Parent = root

    local frame = 1
    local timer = 0
    local fps = 12

    RunService.Heartbeat:Connect(function(dt)
        if not char.Parent then return end
        
        timer = timer + dt
        if timer >= (1/fps) then
            timer = 0
            frame = frame + 1
        end

        local move = hum.MoveDirection
        if move.Magnitude > 0 then
            currentVel = math.min(currentVel + (accel * dt), topSpeed)
        else
            currentVel = math.max(currentVel - (friction * dt), 0)
        end
        hum.WalkSpeed = currentVel

        local state = hum:GetState()
        local airborne = (state == Enum.HumanoidStateType.Jumping or state == Enum.HumanoidStateType.Freefall)

        if airborne then
            fps = 16
            if frame > #sprites.jump then frame = 1 end
            img.Image = sprites.jump[frame]
        elseif currentVel > 24 then
            fps = 20
            if frame > #sprites.run then frame = 1 end
            img.Image = sprites.run[frame]
        elseif currentVel > 1 then
            fps = 10
            if frame > #sprites.walk then frame = 1 end
            img.Image = sprites.walk[frame]
        else
            img.Image = sprites.idle
            frame = 1
        end

        if move.X > 0.1 then
            img.Size = UDim2.new(-1, 0, 1, 0)
        elseif move.X < -0.1 then
            img.Size = UDim2.new(1, 0, 1, 0)
        end
    end)
end

if player.Character then task.spawn(initSonic, player.Character) end
player.CharacterAdded:Connect(initSonic)

Features & Information

he sonic!

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts