Sword manipulation
Key RequiredUniversal

Sword manipulation

Universal ScriptkBAHAHHAHAHAHAH10kBAHAHHAHAHAHAH10 3.2K views 1.1K executesUpdated Jun 27, 2026
Unrated
00
Lua Script•1557 lines (58843 chars)
local TextChatService = game:GetService("TextChatService")
local channel = TextChatService.TextChannels.RBXGeneral
local UserInputService = game:GetService("UserInputService")

channel:SendAsync("[MADE by H4k_03 Rework Achromatix W.I.P]")
task.wait(1)
channel:SendAsync("[MADE by H4k sword manipulator💔💔]")
task.wait(1)
channel:SendAsync("-gh 4458601937,4506945409,4794315940,4820152700,4315489767,4524991457,91879536400252,125809769198711,96606079405209")
task.wait(1)
channel:SendAsync("-gh 97482565589089,101039074901356,112149857520928,11460084205,18705649169,15764682559,1007712372,89979981166745,70669494900153,121071806078203,96724768004231,139335291987488,73933164413334")
task.wait(2)
channel:SendAsync("-gh 4458601937,4506945409,4794315940,4820152700,4315489767,4524991457")
task.wait(1)
channel:SendAsync("-gh 112149857520928,101039074901356,96606079405209,97482565589089,125809769198711,91879536400252")
task.wait(1)
channel:SendAsync("-gh 73933164413334,139335291987488,96724768004231,121071806078203,70669494900153,89979981166745,1007712372,15764682559,18705649169,11460084205")
task.wait(2)
channel:SendAsync("-pd")
task.wait(2)
channel:SendAsync("-net")
task.wait(3)

if game:GetService("Players").LocalPlayer.PlayerGui:FindFirstChild("MusicGui") then
    game:GetService("Players").LocalPlayer.PlayerGui.MusicGui:Destroy()
end
if game:GetService("Players").LocalPlayer.PlayerGui:FindFirstChild("BoomboxGui") then
    game:GetService("Players").LocalPlayer.PlayerGui.BoomboxGui:Destroy()
end
if game:GetService("Players").LocalPlayer.PlayerGui:FindFirstChild("SettingsGui") then
    game:GetService("Players").LocalPlayer.PlayerGui.SettingsGui:Destroy()
end
if game:GetService("Players").LocalPlayer.PlayerGui:FindFirstChild("TrailColorGui") then
    game:GetService("Players").LocalPlayer.PlayerGui.TrailColorGui:Destroy()
end

local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character
local hrp = character:FindFirstChild("HumanoidRootPart")

local settings = {
    orbitSpeed = 0.03,
    orbitHeight = 4,
    beatRange = 9,
    beatSensitivity = 100,
}

local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://110607946439468"
sound.Volume = 1
sound.Looped = true
sound.Parent = workspace
sound:Play()

local boomboxSound = Instance.new("Sound")
boomboxSound.Volume = 1
boomboxSound.Looped = true
boomboxSound.Parent = hrp

local trailColorMode = "rainbow"
local solidTrailColor = Color3.fromRGB(255, 0, 0)

-- =====================
--   ▣ PIXELATION VFX — FULL DETAIL (Sol's RNG faithful)
-- =====================
local lastBeatTime = 0
local beatCooldown = 0.18

-- Single global hue: EVERY piece changes color together at the same time
local pixelHue = 0
local pixelFolder = Instance.new("Folder")
pixelFolder.Name = "PixelationVFX"
pixelFolder.Parent = workspace

-- ── CUBE HEIGHT: above head (~11 studs up from hrp center) ──
local CUBE_HEIGHT = 11

-- Helper: build one cube outline from 12 edge parts
local function buildCube(sz, parent)
    local edges = {}
    local half = sz / 2
    local verts = {
        Vector3.new(-half,-half,-half), Vector3.new( half,-half,-half),
        Vector3.new( half,-half, half), Vector3.new(-half,-half, half),
        Vector3.new(-half, half,-half), Vector3.new( half, half,-half),
        Vector3.new( half, half, half), Vector3.new(-half, half, half),
    }
    local edgePairs = {
        {1,2},{2,3},{3,4},{4,1}, -- bottom
        {5,6},{6,7},{7,8},{8,5}, -- top
        {1,5},{2,6},{3,7},{4,8}, -- verticals
    }
    for _, ep in ipairs(edgePairs) do
        local a, b = verts[ep[1]], verts[ep[2]]
        local mid = (a + b) / 2
        local len = (b - a).Magnitude
        local p = Instance.new("Part")
        p.Size = Vector3.new(0.09, 0.09, len)
        p.Anchored = true
        p.CanCollide = false
        p.CastShadow = false
        p.Material = Enum.Material.Neon
        p.Color = Color3.fromHSV(0, 1, 1)
        p.Parent = parent
        -- store direction for CFrame alignment
        local dir = (b - a).Unit
        table.insert(edges, {part = p, localPos = mid, dir = dir})
    end
    return edges
end

-- 3 cubes: large (7), medium (4.5), small (2.5) — all centered at CUBE_HEIGHT
local cubeData = {}
local cubeSizes = {7, 4.5, 2.5}
local cubeSpeeds = {
    {rx=0.05, ry=0.09, rz=0.04},
    {rx=0.07, ry=0.06, rz=0.08},
    {rx=0.03, ry=0.11, rz=0.06},
}
for ci, sz in ipairs(cubeSizes) do
    local edges = buildCube(sz, pixelFolder)
    cubeData[ci] = {
        edges = edges,
        rx=0, ry=0, rz=0,
        srx = cubeSpeeds[ci].rx,
        sry = cubeSpeeds[ci].ry,
        srz = cubeSpeeds[ci].rz,
        bobOffset = ci * math.pi * 0.7,
    }
end

-- ── PIXEL VORTEX (floor-level outward-spreading ring of pixel squares) ──
local VORTEX_COUNT = 48
local vortexParts = {}
for i = 1, VORTEX_COUNT do
    local p = Instance.new("Part")
    p.Size = Vector3.new(0.28, 0.28, 0.28)
    p.Anchored = true
    p.CanCollide = false
    p.CastShadow = false
    p.Material = Enum.Material.Neon
    p.Color = Color3.fromHSV(0, 1, 1)
    p.Parent = pixelFolder
    table.insert(vortexParts, p)
end

-- ── DUST PARTICLES (inner swirling cloud below player) ──
local DUST_COUNT = 24
local dustParts = {}
for i = 1, DUST_COUNT do
    local p = Instance.new("Part")
    p.Size = Vector3.new(0.12, 0.12, 0.12)
    p.Anchored = true
    p.CanCollide = false
    p.CastShadow = false
    p.Material = Enum.Material.Neon
    p.Color = Color3.fromHSV(0, 1, 1)
    p.Parent = pixelFolder
    table.insert(dustParts, p)
end

-- ── SEGMENTED EQUALIZER BARS (circle around player, stacked squares with gaps) ──
local VIZ_COLS     = 40   -- number of columns around the circle
local VIZ_SEGS     = 10   -- max segments per column
local VIZ_RADIUS   = 6    -- distance from player center
local VIZ_SEG_SIZE = 0.28 -- size of each square segment
local VIZ_GAP      = 0.10 -- gap between segments
local VIZ_STEP     = VIZ_SEG_SIZE + VIZ_GAP

local vizSegParts = {} -- [col][seg] = part
for col = 1, VIZ_COLS do
    vizSegParts[col] = {}
    for seg = 1, VIZ_SEGS do
        local p = Instance.new("Part")
        p.Size = Vector3.new(VIZ_SEG_SIZE, VIZ_SEG_SIZE, VIZ_SEG_SIZE)
        p.Anchored = true
        p.CanCollide = false
        p.CastShadow = false
        p.Material = Enum.Material.Neon
        p.Color = Color3.fromHSV(0, 1, 1)
        p.Transparency = 1 -- hidden until activated by loudness
        p.Parent = pixelFolder
        vizSegParts[col][seg] = p
    end
end

-- ── HEAVY LIGHTNING (thick bolts that flash in/out abruptly) ──
local LIGHTNING_COUNT = 14
local lightningParts = {}
for i = 1, LIGHTNING_COUNT do
    local p = Instance.new("Part")
    p.Size = Vector3.new(0.12, 2 + math.random()*3, 0.12)
    p.Anchored = true
    p.CanCollide = false
    p.CastShadow = false
    p.Material = Enum.Material.Neon
    p.Transparency = 1
    p.Color = Color3.fromHSV(0, 1, 1)
    p.Parent = pixelFolder
    -- Add bright point light to each bolt
    local pl = Instance.new("PointLight", p)
    pl.Brightness = 0
    pl.Range = 12
    table.insert(lightningParts, p)
end

-- ── SCREEN FLASH GUI (on-beat rainbow flash like real Pixelation) ──
local flashGui = Instance.new("ScreenGui")
flashGui.Name = "PixelFlashGui"
flashGui.ResetOnSpawn = false
flashGui.IgnoreGuiInset = true
flashGui.Parent = player.PlayerGui

local flashFrame = Instance.new("Frame")
flashFrame.Size = UDim2.new(1, 0, 1, 0)
flashFrame.BackgroundColor3 = Color3.fromHSV(0, 1, 1)
flashFrame.BackgroundTransparency = 1
flashFrame.BorderSizePixel = 0
flashFrame.ZIndex = 10
flashFrame.Parent = flashGui

-- ── PERSISTENT PIXELATION LOOP ──
local pixelAngle = 0
local bobT = 0
local lightTimer = 0

task.spawn(function()
    while true do
        task.wait(0.028)
        if not hrp or not hrp.Parent then break end

        pixelHue = (pixelHue + 0.014) % 1
        pixelAngle = pixelAngle + 0.075
        bobT = bobT + 0.05
        lightTimer = lightTimer + 1

        local rainbowColor = Color3.fromHSV(pixelHue, 1, 1)
        local hrpPos = hrp.Position
        -- Cube center: above head
        local cubeCenter = hrpPos + Vector3.new(0, CUBE_HEIGHT, 0)

        -- ── Cubes ──
        for ci, cd in ipairs(cubeData) do
            cd.rx = cd.rx + cd.srx
            cd.ry = cd.ry + cd.sry
            cd.rz = cd.rz + cd.srz
            local bob = math.sin(bobT + cd.bobOffset) * 0.5
            local cf = CFrame.new(cubeCenter + Vector3.new(0, bob, 0))
                * CFrame.Angles(cd.rx, cd.ry, cd.rz)
            for _, ed in ipairs(cd.edges) do
                if ed.part and ed.part.Parent then
                    ed.part.Color = rainbowColor
                    -- Place edge: apply cube CFrame to local midpoint, then orient along Z
                    -- using fromMatrix so there's no singularity / scribble
                    local worldPos = (cf * CFrame.new(ed.localPos)).Position
                    local fwd = cf:VectorToWorldSpace(ed.dir)
                    -- Build an orthonormal basis around fwd
                    local up = math.abs(fwd:Dot(Vector3.new(0,1,0))) < 0.99
                        and Vector3.new(0,1,0) or Vector3.new(1,0,0)
                    local right = fwd:Cross(up).Unit
                    local trueUp = right:Cross(fwd).Unit
                    ed.part.CFrame = CFrame.fromMatrix(worldPos, right, trueUp, -fwd)
                end
            end
        end

        -- ── Vortex ring (ground level, spreading outward) ──
        local groundY = hrpPos.Y - 3.2
        for i, p in ipairs(vortexParts) do
            if p and p.Parent then
                local a = -pixelAngle * 2 + (2 * math.pi / VORTEX_COUNT) * (i - 1)
                -- Radius pulses to create spreading effect
                local r = 3.5 + math.sin(pixelAngle * 3 + i * 0.4) * 1.2
                    + math.sin(pixelAngle + i * 0.2) * 0.6
                local px = hrpPos.X + math.cos(a) * r
                local pz = hrpPos.Z + math.sin(a) * r
                local py = groundY + math.abs(math.sin(a * 2.5 + pixelAngle)) * 0.4
                local s = 0.18 + math.random() * 0.22
                p.Size = Vector3.new(s, s, s)
                p.CFrame = CFrame.new(px, py, pz)
                p.Color = rainbowColor
                p.Transparency = 0.15 + math.random() * 0.35
            end
        end

        -- ── Inner dust swirl (tight circle around feet, fades in/out) ──
        for i, p in ipairs(dustParts) do
            if p and p.Parent then
                local a = pixelAngle * 3 + (2 * math.pi / DUST_COUNT) * (i - 1)
                local r = 1.2 + math.sin(bobT * 2 + i) * 0.4
                local py = groundY + 0.1 + math.sin(a * 2 + bobT) * 0.3
                p.CFrame = CFrame.new(hrpPos.X + math.cos(a)*r, py, hrpPos.Z + math.sin(a)*r)
                p.Color = rainbowColor
                p.Size = Vector3.new(0.1, 0.1, 0.1)
                p.Transparency = 0.3 + math.random() * 0.5
            end
        end

        -- ── Segmented equalizer bars (circle, stacked square segments, gaps between) ──
        local activeSnd2 = boomboxSound.IsPlaying and boomboxSound or sound
        local loudness2 = activeSnd2.PlaybackLoudness
        local baseY = hrpPos.Y - 2.8 -- bars start just below waist

        for col = 1, VIZ_COLS do
            local a = (2 * math.pi / VIZ_COLS) * (col - 1) + pixelAngle * 0.4
            local bx = hrpPos.X + math.cos(a) * VIZ_RADIUS
            local bz = hrpPos.Z + math.sin(a) * VIZ_RADIUS

            -- Each column gets a slightly different wave offset for a realistic EQ look
            local wave = math.sin(bobT * 1.2 + col * 0.45) * 0.5 + 0.5
            local activeSegs = math.clamp(
                math.floor(1 + (loudness2 / 512) * VIZ_SEGS * (0.5 + wave * 0.5)),
                1, VIZ_SEGS
            )

            for seg = 1, VIZ_SEGS do
                local p = vizSegParts[col][seg]
                if p and p.Parent then
                    if seg <= activeSegs then
                        -- Hue shifts from bottom (current hue) to top (shifted)
                        local segHue = (pixelHue + (seg / VIZ_SEGS) * 0.25) % 1
                        p.Color = Color3.fromHSV(segHue, 1, 1)
                        p.Transparency = 0
                        p.CFrame = CFrame.new(bx, baseY + (seg - 1) * VIZ_STEP + VIZ_SEG_SIZE/2, bz)
                    else
                        p.Transparency = 1
                    end
                end
            end
        end

        -- ── Lightning: flash in/out every 2–4 frames abruptly ──
        if lightTimer % 2 == 0 then
            for _, lp in ipairs(lightningParts) do
                if lp and lp.Parent then
                    local show = math.random() > 0.45
                    if show then
                        local la = math.random() * math.pi * 2
                        local lr = 1.8 + math.random() * 5
                        lp.CFrame = CFrame.new(
                            hrpPos.X + math.cos(la) * lr,
                            hrpPos.Y + math.random() * 7 - 0.5,
                            hrpPos.Z + math.sin(la) * lr
                        ) * CFrame.Angles(
                            math.random() * math.pi,
                            math.random() * math.pi,
                            math.random() * math.pi
                        )
                        lp.Size = Vector3.new(0.1, 0.6 + math.random() * 3.5, 0.1)
                        lp.Color = rainbowColor
                        lp.Transparency = math.random() * 0.2
                        local pl = lp:FindFirstChildOfClass("PointLight")
                        if pl then
                            pl.Color = rainbowColor
                            pl.Brightness = 1.5 + math.random() * 2
                        end
                    else
                        lp.Transparency = 1
                        local pl = lp:FindFirstChildOfClass("PointLight")
                        if pl then pl.Brightness = 0 end
                    end
                end
            end
        end
    end
end)

-- ── ON-BEAT: screen flash + pixel shard burst + upward arrows ──
local function firePixelationBurst()
    local now = tick()
    if now - lastBeatTime < beatCooldown then return end
    lastBeatTime = now

    -- SCREEN FLASH: bright rainbow color flash that fades in ~0.25s
    task.spawn(function()
        local flashHue = pixelHue
        flashFrame.BackgroundColor3 = Color3.fromHSV(flashHue, 1, 1)
        flashFrame.BackgroundTransparency = 0.35
        for i = 1, 10 do
            task.wait(0.025)
            flashHue = (flashHue + 0.08) % 1
            flashFrame.BackgroundColor3 = Color3.fromHSV(flashHue, 1, 1)
            flashFrame.BackgroundTransparency = 0.35 + (i / 10) * 0.65
        end
        flashFrame.BackgroundTransparency = 1
    end)

    -- PIXEL SHARD BURST + UPWARD ARROWS
    task.spawn(function()
        local burstParts = {}
        local burstHue = pixelHue

        -- Pixel shards (glitchy squares scatter outward + arc up)
        for i = 1, 28 do
            local p = Instance.new("Part")
            local s = 0.18 + math.random() * 0.45
            p.Size = Vector3.new(s, s, s)
            p.Anchored = true
            p.CanCollide = false
            p.CastShadow = false
            p.Material = Enum.Material.Neon
            p.Color = Color3.fromHSV((burstHue + i/28) % 1, 1, 1)
            p.Parent = workspace
            local sa = math.random() * math.pi * 2
            local sr = math.random() * 2.5
            table.insert(burstParts, {
                part = p,
                sx = hrp.Position.X + math.cos(sa)*sr,
                sy = hrp.Position.Y + 2 + math.random()*3,
                sz = hrp.Position.Z + math.sin(sa)*sr,
                vx = math.cos(sa) * (4 + math.random()*6),
                vy = 5 + math.random() * 7,
                vz = math.sin(sa) * (4 + math.random()*6),
                isArrow = false,
            })
        end

        -- Upward arrow parts (thin vertical neon pillars floating up)
        for i = 1, 12 do
            local p = Instance.new("Part")
            p.Size = Vector3.new(0.1, 1.4, 0.1)
            p.Anchored = true
            p.CanCollide = false
            p.CastShadow = false
            p.Material = Enum.Material.Neon
            p.Color = Color3.fromHSV((burstHue + i/12) % 1, 1, 1)
            p.Parent = workspace
            local aa = (2*math.pi/12)*(i-1) + math.random()*0.4
            local ar = 1.2 + math.random() * 3
            table.insert(burstParts, {
                part = p,
                sx = hrp.Position.X + math.cos(aa)*ar,
                sy = hrp.Position.Y + 1.5 + math.random()*2,
                sz = hrp.Position.Z + math.sin(aa)*ar,
                vx = 0, vy = 9 + math.random()*5, vz = 0,
                isArrow = true,
            })
        end

        -- Also spawn 2 large rainbow rings expanding outward (2D pixel rings)
        local ringParts = {}
        for ring = 1, 2 do
            local ringH = hrp.Position.Y + (ring == 1 and 1 or CUBE_HEIGHT)
            for j = 1, 24 do
                local p = Instance.new("Part")
                p.Size = Vector3.new(0.3, 0.3, 0.3)
                p.Anchored = true
                p.CanCollide = false
                p.CastShadow = false
                p.Material = Enum.Material.Neon
                p.Color = Color3.fromHSV((burstHue + j/24 + ring*0.3) % 1, 1, 1)
                p.Parent = workspace
                local ra = (2*math.pi/24)*(j-1)
                table.insert(ringParts, {part=p, angle=ra, startR=0.5, ringY=ringH})
            end
        end

        -- Animate
        local steps = 24
        for step = 1, steps do
            local t = step / steps
            local alpha = 1 - t
            local dt = step * 0.017

            for _, b in ipairs(burstParts) do
                if b.part and b.part.Parent then
                    local gravity = b.isArrow and 0 or 5.5
                    b.part.CFrame = CFrame.new(
                        b.sx + b.vx * dt,
                        b.sy + b.vy * dt - gravity * dt * dt,
                        b.sz + b.vz * dt
                    )
                    b.part.Transparency = alpha
                    b.part.Color = Color3.fromHSV((burstHue + t*0.6 + step*0.02) % 1, 1, 1)
                end
            end

            -- Rings expand outward
            local ringR = t * 14
            for _, rp in ipairs(ringParts) do
                if rp.part and rp.part.Parent then
                    rp.part.CFrame = CFrame.new(
                        hrp.Position.X + math.cos(rp.angle) * ringR,
                        rp.ringY,
                        hrp.Position.Z + math.sin(rp.angle) * ringR
                    )
                    rp.part.Transparency = alpha
                    rp.part.Color = Color3.fromHSV((burstHue + t*0.4) % 1, 1, 1)
                end
            end

            task.wait(0.017)
        end

        for _, b in ipairs(burstParts) do
            if b.part and b.part.Parent then b.part:Destroy() end
        end
        for _, rp in ipairs(ringParts) do
            if rp.part and rp.part.Parent then rp.part:Destroy() end
        end
    end)
end

-- =====================
--   MUSIC PLAYER GUI
-- =====================
local sg = Instance.new("ScreenGui")
sg.Name = "MusicGui"
sg.ResetOnSpawn = false
sg.Parent = player.PlayerGui

local frame = Instance.new("Frame")
frame.Size = UDim2.new(0, 200, 0, 130)
frame.Position = UDim2.new(1, -210, 0, 10)
frame.BackgroundColor3 = Color3.fromRGB(15, 15, 25)
frame.BorderSizePixel = 0
frame.Active = true
frame.Draggable = true
frame.Parent = sg
Instance.new("UICorner", frame).CornerRadius = UDim.new(0, 12)

local stroke = Instance.new("UIStroke")
stroke.Color = Color3.fromRGB(0, 180, 255)
stroke.Thickness = 1.5
stroke.Parent = frame

local title = Instance.new("TextLabel")
title.Size = UDim2.new(1, 0, 0, 30)
title.BackgroundTransparency = 1
title.Text = "🎵 MUSIC PLAYER"
title.TextColor3 = Color3.fromRGB(0, 200, 255)
title.Font = Enum.Font.GothamBold
title.TextSize = 13
title.Parent = frame

local playBtn = Instance.new("TextButton")
playBtn.Size = UDim2.new(0, 80, 0, 30)
playBtn.Position = UDim2.new(0, 10, 0, 38)
playBtn.BackgroundColor3 = Color3.fromRGB(0, 210, 90)
playBtn.Text = "⏸ PAUSE"
playBtn.TextColor3 = Color3.fromRGB(255,255,255)
playBtn.Font = Enum.Font.GothamBold
playBtn.TextSize = 11
playBtn.BorderSizePixel = 0
playBtn.Parent = frame
Instance.new("UICorner", playBtn).CornerRadius = UDim.new(0, 8)

local stopBtn = Instance.new("TextButton")
stopBtn.Size = UDim2.new(0, 80, 0, 30)
stopBtn.Position = UDim2.new(1, -90, 0, 38)
stopBtn.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
stopBtn.Text = "⏹ STOP"
stopBtn.TextColor3 = Color3.fromRGB(255,255,255)
stopBtn.Font = Enum.Font.GothamBold
stopBtn.TextSize = 11
stopBtn.BorderSizePixel = 0
stopBtn.Parent = frame
Instance.new("UICorner", stopBtn).CornerRadius = UDim.new(0, 8)

local volLabel = Instance.new("TextLabel")
volLabel.Size = UDim2.new(1, 0, 0, 20)
volLabel.Position = UDim2.new(0, 0, 0, 75)
volLabel.BackgroundTransparency = 1
volLabel.Text = "Volume: 100%"
volLabel.TextColor3 = Color3.fromRGB(150, 150, 170)
volLabel.Font = Enum.Font.Gotham
volLabel.TextSize = 11
volLabel.Parent = frame

local minusBtn = Instance.new("TextButton")
minusBtn.Size = UDim2.new(0, 30, 0, 20)
minusBtn.Position = UDim2.new(0, 10, 0, 78)
minusBtn.BackgroundColor3 = Color3.fromRGB(0, 130, 200)
minusBtn.Text = "-"
minusBtn.TextColor3 = Color3.fromRGB(255,255,255)
minusBtn.Font = Enum.Font.GothamBold
minusBtn.TextSize = 13
minusBtn.BorderSizePixel = 0
minusBtn.Parent = frame
Instance.new("UICorner", minusBtn).CornerRadius = UDim.new(0, 5)

local plusBtn = Instance.new("TextButton")
plusBtn.Size = UDim2.new(0, 30, 0, 20)
plusBtn.Position = UDim2.new(1, -40, 0, 78)
plusBtn.BackgroundColor3 = Color3.fromRGB(0, 130, 200)
plusBtn.Text = "+"
plusBtn.TextColor3 = Color3.fromRGB(255,255,255)
plusBtn.Font = Enum.Font.GothamBold
plusBtn.TextSize = 13
plusBtn.BorderSizePixel = 0
plusBtn.Parent = frame
Instance.new("UICorner", plusBtn).CornerRadius = UDim.new(0, 5)

local modeLabel = Instance.new("TextLabel")
modeLabel.Size = UDim2.new(1, 0, 0, 20)
modeLabel.Position = UDim2.new(0, 0, 0, 105)
modeLabel.BackgroundTransparency = 1
modeLabel.Text = "[G][H][J][T][R][D][X][C][Z][L]"
modeLabel.TextColor3 = Color3.fromRGB(150, 150, 170)
modeLabel.Font = Enum.Font.GothamBold
modeLabel.TextSize = 9
modeLabel.Parent = frame

local paused = false
playBtn.MouseButton1Click:Connect(function()
    paused = not paused
    if paused then
        sound:Pause()
        playBtn.Text = "â–¶ PLAY"
        playBtn.BackgroundColor3 = Color3.fromRGB(0, 160, 255)
    else
        sound:Resume()
        playBtn.Text = "⏸ PAUSE"
        playBtn.BackgroundColor3 = Color3.fromRGB(0, 210, 90)
    end
end)
stopBtn.MouseButton1Click:Connect(function()
    sound:Stop()
    sound:Destroy()
    sg:Destroy()
end)
plusBtn.MouseButton1Click:Connect(function()
    sound.Volume = math.min(sound.Volume + 0.1, 1)
    volLabel.Text = "Volume: " .. math.floor(sound.Volume * 100) .. "%"
end)
minusBtn.MouseButton1Click:Connect(function()
    sound.Volume = math.max(sound.Volume - 0.1, 0)
    volLabel.Text = "Volume: " .. math.floor(sound.Volume * 100) .. "%"
end)

-- =====================
--   BOOMBOX GUI
-- =====================
local bsg = Instance.new("ScreenGui")
bsg.Name = "BoomboxGui"
bsg.ResetOnSpawn = false
bsg.Parent = player.PlayerGui

local bframe = Instance.new("Frame")
bframe.Size = UDim2.new(0, 220, 0, 140)
bframe.Position = UDim2.new(1, -230, 0, 150)
bframe.BackgroundColor3 = Color3.fromRGB(15, 15, 25)
bframe.BorderSizePixel = 0
bframe.Active = true
bframe.Draggable = true
bframe.Parent = bsg
Instance.new("UICorner", bframe).CornerRadius = UDim.new(0, 12)

local bstroke = Instance.new("UIStroke")
bstroke.Color = Color3.fromRGB(255, 100, 0)
bstroke.Thickness = 1.5
bstroke.Parent = bframe

local btitle = Instance.new("TextLabel")
btitle.Size = UDim2.new(1, 0, 0, 30)
btitle.BackgroundTransparency = 1
btitle.Text = "📻 FE BOOMBOX"
btitle.TextColor3 = Color3.fromRGB(255, 150, 0)
btitle.Font = Enum.Font.GothamBold
btitle.TextSize = 13
btitle.Parent = bframe

local idBox = Instance.new("TextBox")
idBox.Size = UDim2.new(0, 200, 0, 30)
idBox.Position = UDim2.new(0.5, -100, 0, 35)
idBox.BackgroundColor3 = Color3.fromRGB(30, 30, 45)
idBox.Text = "Enter Song ID..."
idBox.TextColor3 = Color3.fromRGB(200, 200, 200)
idBox.Font = Enum.Font.Gotham
idBox.TextSize = 12
idBox.BorderSizePixel = 0
idBox.ClearTextOnFocus = true
idBox.Parent = bframe
Instance.new("UICorner", idBox).CornerRadius = UDim.new(0, 6)

local bplayBtn = Instance.new("TextButton")
bplayBtn.Size = UDim2.new(0, 95, 0, 28)
bplayBtn.Position = UDim2.new(0, 10, 0, 73)
bplayBtn.BackgroundColor3 = Color3.fromRGB(255, 120, 0)
bplayBtn.Text = "â–¶ PLAY"
bplayBtn.TextColor3 = Color3.fromRGB(255,255,255)
bplayBtn.Font = Enum.Font.GothamBold
bplayBtn.TextSize = 12
bplayBtn.BorderSizePixel = 0
bplayBtn.Parent = bframe
Instance.new("UICorner", bplayBtn).CornerRadius = UDim.new(0, 6)

local bstopBtn = Instance.new("TextButton")
bstopBtn.Size = UDim2.new(0, 95, 0, 28)
bstopBtn.Position = UDim2.new(1, -105, 0, 73)
bstopBtn.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
bstopBtn.Text = "⏹ STOP"
bstopBtn.TextColor3 = Color3.fromRGB(255,255,255)
bstopBtn.Font = Enum.Font.GothamBold
bstopBtn.TextSize = 12
bstopBtn.BorderSizePixel = 0
bstopBtn.Parent = bframe
Instance.new("UICorner", bstopBtn).CornerRadius = UDim.new(0, 6)

local bvolLabel = Instance.new("TextLabel")
bvolLabel.Size = UDim2.new(1, 0, 0, 20)
bvolLabel.Position = UDim2.new(0, 0, 0, 108)
bvolLabel.BackgroundTransparency = 1
bvolLabel.Text = "Vol: 100%"
bvolLabel.TextColor3 = Color3.fromRGB(150, 150, 170)
bvolLabel.Font = Enum.Font.Gotham
bvolLabel.TextSize = 11
bvolLabel.Parent = bframe

local bminusBtn = Instance.new("TextButton")
bminusBtn.Size = UDim2.new(0, 30, 0, 20)
bminusBtn.Position = UDim2.new(0, 10, 0, 112)
bminusBtn.BackgroundColor3 = Color3.fromRGB(255, 120, 0)
bminusBtn.Text = "-"
bminusBtn.TextColor3 = Color3.fromRGB(255,255,255)
bminusBtn.Font = Enum.Font.GothamBold
bminusBtn.TextSize = 13
bminusBtn.BorderSizePixel = 0
bminusBtn.Parent = bframe
Instance.new("UICorner", bminusBtn).CornerRadius = UDim.new(0, 5)

local bplusBtn = Instance.new("TextButton")
bplusBtn.Size = UDim2.new(0, 30, 0, 20)
bplusBtn.Position = UDim2.new(1, -40, 0, 112)
bplusBtn.BackgroundColor3 = Color3.fromRGB(255, 120, 0)
bplusBtn.Text = "+"
bplusBtn.TextColor3 = Color3.fromRGB(255,255,255)
bplusBtn.Font = Enum.Font.GothamBold
bplusBtn.TextSize = 13
bplusBtn.BorderSizePixel = 0
bplusBtn.Parent = bframe
Instance.new("UICorner", bplusBtn).CornerRadius = UDim.new(0, 5)

bplayBtn.MouseButton1Click:Connect(function()
    local id = tonumber(idBox.Text)
    if id then
        boomboxSound.SoundId = "rbxassetid://" .. id
        boomboxSound:Play()
        btitle.Text = "📻 Playing!"
        btitle.TextColor3 = Color3.fromRGB(0, 210, 90)
    else
        btitle.Text = "❌ Invalid ID!"
        btitle.TextColor3 = Color3.fromRGB(255, 50, 50)
        task.wait(1.5)
        btitle.Text = "📻 FE BOOMBOX"
        btitle.TextColor3 = Color3.fromRGB(255, 150, 0)
    end
end)
bstopBtn.MouseButton1Click:Connect(function()
    boomboxSound:Stop()
    btitle.Text = "📻 FE BOOMBOX"
    btitle.TextColor3 = Color3.fromRGB(255, 150, 0)
end)
bplusBtn.MouseButton1Click:Connect(function()
    boomboxSound.Volume = math.min(boomboxSound.Volume + 0.1, 1)
    bvolLabel.Text = "Vol: " .. math.floor(boomboxSound.Volume * 100) .. "%"
end)
bminusBtn.MouseButton1Click:Connect(function()
    boomboxSound.Volume = math.max(boomboxSound.Volume - 0.1, 0)
    bvolLabel.Text = "Vol: " .. math.floor(boomboxSound.Volume * 100) .. "%"
end)

-- =====================
--   SETTINGS GUI
-- =====================
local ssg = Instance.new("ScreenGui")
ssg.Name = "SettingsGui"
ssg.ResetOnSpawn = false
ssg.Parent = player.PlayerGui

local sframe = Instance.new("Frame")
sframe.Size = UDim2.new(0, 220, 0, 220)
sframe.Position = UDim2.new(0, 10, 0.5, -110)
sframe.BackgroundColor3 = Color3.fromRGB(15, 15, 25)
sframe.BorderSizePixel = 0
sframe.Active = true
sframe.Draggable = true
sframe.Parent = ssg
Instance.new("UICorner", sframe).CornerRadius = UDim.new(0, 12)

local sstroke = Instance.new("UIStroke")
sstroke.Color = Color3.fromRGB(150, 0, 255)
sstroke.Thickness = 1.5
sstroke.Parent = sframe

local stitle = Instance.new("TextLabel")
stitle.Size = UDim2.new(1, 0, 0, 30)
stitle.BackgroundTransparency = 1
stitle.Text = "âš™ ORBIT SETTINGS"
stitle.TextColor3 = Color3.fromRGB(180, 0, 255)
stitle.Font = Enum.Font.GothamBold
stitle.TextSize = 13
stitle.Parent = sframe

local function makeSettingRow(parent, label, yPos, getValue, onPlus, onMinus)
    local lbl = Instance.new("TextLabel")
    lbl.Size = UDim2.new(1, 0, 0, 18)
    lbl.Position = UDim2.new(0, 0, 0, yPos)
    lbl.BackgroundTransparency = 1
    lbl.Text = label .. ": " .. tostring(getValue())
    lbl.TextColor3 = Color3.fromRGB(200, 200, 220)
    lbl.Font = Enum.Font.GothamBold
    lbl.TextSize = 11
    lbl.Parent = parent

    local mBtn = Instance.new("TextButton")
    mBtn.Size = UDim2.new(0, 35, 0, 22)
    mBtn.Position = UDim2.new(0, 10, 0, yPos + 18)
    mBtn.BackgroundColor3 = Color3.fromRGB(150, 0, 255)
    mBtn.Text = "-"
    mBtn.TextColor3 = Color3.fromRGB(255,255,255)
    mBtn.Font = Enum.Font.GothamBold
    mBtn.TextSize = 13
    mBtn.BorderSizePixel = 0
    mBtn.Parent = parent
    Instance.new("UICorner", mBtn).CornerRadius = UDim.new(0, 6)

    local pBtn = Instance.new("TextButton")
    pBtn.Size = UDim2.new(0, 35, 0, 22)
    pBtn.Position = UDim2.new(1, -45, 0, yPos + 18)
    pBtn.BackgroundColor3 = Color3.fromRGB(150, 0, 255)
    pBtn.Text = "+"
    pBtn.TextColor3 = Color3.fromRGB(255,255,255)
    pBtn.Font = Enum.Font.GothamBold
    pBtn.TextSize = 13
    pBtn.BorderSizePixel = 0
    pBtn.Parent = parent
    Instance.new("UICorner", pBtn).CornerRadius = UDim.new(0, 6)

    mBtn.MouseButton1Click:Connect(function()
        onMinus()
        lbl.Text = label .. ": " .. tostring(getValue())
    end)
    pBtn.MouseButton1Click:Connect(function()
        onPlus()
        lbl.Text = label .. ": " .. tostring(getValue())
    end)
end

makeSettingRow(sframe, "Speed", 32,
    function() return math.floor(settings.orbitSpeed * 1000) / 1000 end,
    function() settings.orbitSpeed = math.min(settings.orbitSpeed + 0.005, 0.2) end,
    function() settings.orbitSpeed = math.max(settings.orbitSpeed - 0.005, 0.005) end
)
makeSettingRow(sframe, "Height", 82,
    function() return settings.orbitHeight end,
    function() settings.orbitHeight = math.min(settings.orbitHeight + 1, 100) end,
    function() settings.orbitHeight = math.max(settings.orbitHeight - 1, 0) end
)
makeSettingRow(sframe, "Radius", 132,
    function() return settings.beatRange end,
    function() settings.beatRange = math.min(settings.beatRange + 1, 200) end,
    function() settings.beatRange = math.max(settings.beatRange - 1, 3) end
)
makeSettingRow(sframe, "Beat", 182,
    function() return settings.beatSensitivity end,
    function() settings.beatSensitivity = math.min(settings.beatSensitivity + 10, 500) end,
    function() settings.beatSensitivity = math.max(settings.beatSensitivity - 10, 10) end
)

-- =====================
--   TRAIL COLOR GUI
-- =====================
local colorGui = Instance.new("ScreenGui")
colorGui.Name = "TrailColorGui"
colorGui.ResetOnSpawn = false
colorGui.Enabled = false
colorGui.Parent = player.PlayerGui

local colorFrame = Instance.new("Frame")
colorFrame.Size = UDim2.new(0, 260, 0, 320)
colorFrame.Position = UDim2.new(0.5, -130, 0.5, -160)
colorFrame.BackgroundColor3 = Color3.fromRGB(15, 15, 25)
colorFrame.BackgroundTransparency = 0.1
colorFrame.BorderSizePixel = 0
colorFrame.Active = true
colorFrame.Draggable = true
colorFrame.Parent = colorGui
Instance.new("UICorner", colorFrame).CornerRadius = UDim.new(0, 12)

local cstroke = Instance.new("UIStroke")
cstroke.Color = Color3.fromRGB(255, 0, 128)
cstroke.Thickness = 2
cstroke.Parent = colorFrame

local ctitle = Instance.new("TextLabel")
ctitle.Size = UDim2.new(1, 0, 0, 30)
ctitle.Position = UDim2.new(0, 0, 0, 5)
ctitle.BackgroundTransparency = 1
ctitle.Text = "🌈 TRAIL COLOR - Press L to close"
ctitle.TextColor3 = Color3.fromRGB(255, 100, 200)
ctitle.Font = Enum.Font.GothamBold
ctitle.TextSize = 11
ctitle.Parent = colorFrame

local colors = {
    {"🌈 Rainbow", "rainbow", Color3.fromRGB(255, 100, 200)},
    {"🔴 Red", Color3.fromRGB(255, 0, 0), Color3.fromRGB(255, 0, 0)},
    {"🟠 Orange", Color3.fromRGB(255, 140, 0), Color3.fromRGB(255, 140, 0)},
    {"🟡 Yellow", Color3.fromRGB(255, 255, 0), Color3.fromRGB(255, 255, 0)},
    {"🟢 Green", Color3.fromRGB(0, 255, 0), Color3.fromRGB(0, 255, 0)},
    {"🔵 Blue", Color3.fromRGB(0, 100, 255), Color3.fromRGB(0, 100, 255)},
    {"🟣 Purple", Color3.fromRGB(180, 0, 255), Color3.fromRGB(180, 0, 255)},
    {"🩷 Pink", Color3.fromRGB(255, 100, 200), Color3.fromRGB(255, 100, 200)},
    {"⚪ White", Color3.fromRGB(255, 255, 255), Color3.fromRGB(255, 255, 255)},
    {"âš« Black", Color3.fromRGB(20, 20, 20), Color3.fromRGB(20, 20, 20)},
    {"🩵 Cyan", Color3.fromRGB(0, 255, 255), Color3.fromRGB(0, 255, 255)},
    {"🟤 Brown", Color3.fromRGB(150, 75, 0), Color3.fromRGB(150, 75, 0)},
}

for i, colorData in ipairs(colors) do
    local btn = Instance.new("TextButton")
    btn.Size = UDim2.new(0, 110, 0, 22)
    local col = (i - 1) % 2
    local row = math.floor((i - 1) / 2)
    btn.Position = UDim2.new(0, 10 + col * 130, 0, 38 + row * 28)
    btn.BackgroundColor3 = colorData[3]
    btn.Text = colorData[1]
    btn.TextColor3 = Color3.fromRGB(255, 255, 255)
    btn.Font = Enum.Font.GothamBold
    btn.TextSize = 10
    btn.BorderSizePixel = 0
    btn.Parent = colorFrame
    Instance.new("UICorner", btn).CornerRadius = UDim.new(0, 6)

    btn.MouseButton1Click:Connect(function()
        if colorData[2] == "rainbow" then
            trailColorMode = "rainbow"
            ctitle.Text = "🌈 Mode: Rainbow"
        else
            trailColorMode = "solid"
            solidTrailColor = colorData[2]
            ctitle.Text = "🎨 Color: " .. colorData[1]
        end
        btn.BackgroundTransparency = 0.4
        task.wait(0.2)
        btn.BackgroundTransparency = 0
    end)

    btn.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.Touch then
            btn.MouseButton1Click:Fire()
        end
    end)
end

local closeBtn = Instance.new("TextButton")
closeBtn.Size = UDim2.new(0, 220, 0, 26)
closeBtn.Position = UDim2.new(0.5, -110, 1, -32)
closeBtn.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
closeBtn.Text = "❌ Close"
closeBtn.TextColor3 = Color3.fromRGB(255,255,255)
closeBtn.Font = Enum.Font.GothamBold
closeBtn.TextSize = 12
closeBtn.BorderSizePixel = 0
closeBtn.Parent = colorFrame
Instance.new("UICorner", closeBtn).CornerRadius = UDim.new(0, 8)

closeBtn.MouseButton1Click:Connect(function()
    colorGui.Enabled = false
end)
closeBtn.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.Touch then
        colorGui.Enabled = false
    end
end)

-- =====================
--   AUDIO VISUALIZER
-- =====================
local vizParts = {}
local VIZ_COUNT = 40
local VIZ_RADIUS = 6
local vizFolder = Instance.new("Folder")
vizFolder.Name = "AudioViz"
vizFolder.Parent = workspace

for i = 1, VIZ_COUNT do
    local part = Instance.new("Part")
    part.Size = Vector3.new(0.35, 0.5, 0.35)
    part.Anchored = true
    part.CanCollide = false
    part.CastShadow = false
    part.Material = Enum.Material.Neon
    part.Color = Color3.fromHSV((i / VIZ_COUNT), 1, 1)
    part.Parent = vizFolder
    table.insert(vizParts, part)
end

-- =====================
--   SWORD SETUP
-- =====================
local angle = 0
local haloAngle = 0
local running = true
local wingMode = false
local haloMode = false
local jMode = false
local tMode = false
local rMode = false
local dMode = false
local xMode = false
local cMode = false
local zMode = false

local xSwordAssignments = {}
local flingCooldowns = {}

local starPositions = {
    {8, 0, 0, 0, 0, 45},
    {-8, 0, 0, 0, 0, -45},
    {0, 0, 8, 0, 90, 0},
    {0, 0, -8, 0, -90, 0},
    {6, 4, 6, 45, 45, 0},
    {-6, 4, 6, 45, -45, 0},
}

local oldSwordNames = {
    "MeshPartAccessory",
    "ShadowBladeMasterAccessory",
    "BladeMasterAccessory",
}
local blackSwordNames = {
    "Accessory (MeshPartAccessory)",
    "Accessory (defaultAccessory)",
    "Accessory (default)",
}
local newSwordNames = {
    "Accessory (MeshAccessory)",
    "Accessory (Berserker (2)Accessory)",
    "Accessory (Plane.001Accessory)",
}

local wingPositions = {
    {2, 0.5, -0.5, 0, 30, 20},
    {4, 1.5, -0.8, 0, 45, 30},
    {6, 2.5, -1, 0, 55, 40},
    {8, 3.5, -1.2, 0, 60, 50},
    {4.5, 0, -0.5, 0, 35, 15},
    {7, 1, -1, 0, 50, 25},
}

local jSphereAngles = {}
local function setupJAngles(total)
    jSphereAngles = {}
    local goldenRatio = (1 + math.sqrt(5)) / 2
    for i = 1, total do
        local theta = math.acos(1 - 2 * i / total)
        local phi = 2 * math.pi * i / goldenRatio
        table.insert(jSphereAngles, {theta = theta, phi = phi})
    end
end

if _G.SwordFloatCleanup then _G.SwordFloatCleanup() end

task.wait(5)

local oldSwords = {}
local orbitSwords = {}
local allSwordsList = {}

local function addRainbowTrail(handle, index, total)
    local att0 = Instance.new("Attachment", handle)
    att0.Position = Vector3.new(0, 0.5, 0)
    att0.Name = "TrailAtt0"

    local att1 = Instance.new("Attachment", handle)
    att1.Position = Vector3.new(0, -0.5, 0)
    att1.Name = "TrailAtt1"

    local trail = Instance.new("Trail", handle)
    trail.Attachment0 = att0
    trail.Attachment1 = att1
    trail.Lifetime = 0.6
    trail.MinLength = 0
    trail.FaceCamera = true
    trail.LightEmission = 1
    trail.LightInfluence = 0
    trail.WidthScale = NumberSequence.new({
        NumberSequenceKeypoint.new(0, 1),
        NumberSequenceKeypoint.new(1, 0),
    })

    local keypoints = {}
    for s = 0, 6 do
        local t = s / 6
        local hue = (t + (index / math.max(total, 1))) % 1
        table.insert(keypoints, ColorSequenceKeypoint.new(t, Color3.fromHSV(hue, 1, 1)))
    end
    trail.Color = ColorSequence.new(keypoints)

    return trail, att0, att1
end

local totalSwords = 0
for _, obj in ipairs(character:GetChildren()) do
    local handle = obj:FindFirstChild("Handle")
    if handle then
        for _, n in ipairs(oldSwordNames) do if obj.Name == n then totalSwords += 1 end end
        for _, n in ipairs(blackSwordNames) do if obj.Name == n then totalSwords += 1 end end
        for _, n in ipairs(newSwordNames) do if obj.Name == n then totalSwords += 1 end end
    end
end

local swordIndex = 0
local function setupSword(handle)
    for _, w in ipairs(handle:GetChildren()) do
        if w:IsA("Weld") or w:IsA("WeldConstraint") or w:IsA("Motor6D") then
            w:Destroy()
        end
    end
    handle.Massless = true
    handle.CanCollide = false

    local attachA = Instance.new("Attachment", handle)
    local attachB = Instance.new("Attachment", hrp)

    local alignPos = Instance.new("AlignPosition", handle)
    alignPos.ApplyAtCenterOfMass = true
    alignPos.MaxForce = math.huge
    alignPos.MaxVelocity = math.huge
    alignPos.ReactionForceEnabled = false
    alignPos.Responsiveness = 200
    alignPos.RigidityEnabled = true
    alignPos.Attachment0 = attachA
    alignPos.Attachment1 = attachB

    local alignOri = Instance.new("AlignOrientation", handle)
    alignOri.MaxAngularVelocity = math.huge
    alignOri.MaxTorque = math.huge
    alignOri.ReactionTorqueEnabled = false
    alignOri.Responsiveness = 200
    alignOri.RigidityEnabled = true
    alignOri.Attachment0 = attachA
    alignOri.Attachment1 = attachB

    swordIndex = swordIndex + 1
    local trail, tAtt0, tAtt1 = addRainbowTrail(handle, swordIndex, totalSwords)

    return {
        handle = handle,
        attachA = attachA,
        attachB = attachB,
        alignPos = alignPos,
        alignOri = alignOri,
        trail = trail,
        trailAtt0 = tAtt0,
        trailAtt1 = tAtt1,
        index = swordIndex,
    }
end

for _, obj in ipairs(character:GetChildren()) do
    local handle = obj:FindFirstChild("Handle")
    if handle then
        local isOld, isBlack, isNew = false, false, false
        for _, n in ipairs(oldSwordNames) do if obj.Name == n then isOld = true break end end
        for _, n in ipairs(blackSwordNames) do if obj.Name == n then isBlack = true break end end
        for _, n in ipairs(newSwordNames) do if obj.Name == n then isNew = true break end end

        if isOld then
            local data = setupSword(handle)
            table.insert(oldSwords, data)
            table.insert(allSwordsList, data)
        elseif isBlack or isNew then
            local data = setupSword(handle)
            table.insert(orbitSwords, data)
            table.insert(allSwordsList, data)
        end
    end
end

-- Rainbow trail cycle loop
task.spawn(function()
    local t = 0
    while running do
        task.wait(0.05)
        t = t + 0.025
        for i, data in ipairs(allSwordsList) do
            if data.trail and data.trail.Parent then
                if trailColorMode == "rainbow" then
                    local keypoints = {}
                    for s = 0, 6 do
                        local frac = s / 6
                        local hue = (frac + (i / #allSwordsList) + t) % 1
                        table.insert(keypoints, ColorSequenceKeypoint.new(frac, Color3.fromHSV(hue, 1, 1)))
                    end
                    data.trail.Color = ColorSequence.new(keypoints)
                else
                    data.trail.Color = ColorSequence.new(solidTrailColor)
                end
            end
        end
    end
end)

local dSwordData = {}
for i = 1, #oldSwords do
    dSwordData[i] = {
        angleX = math.random() * math.pi * 2,
        angleY = math.random() * math.pi * 2,
        angleZ = math.random() * math.pi * 2,
        speedX = (math.random() - 0.5) * 0.08,
        speedY = (math.random() - 0.5) * 0.06,
        speedZ = (math.random() - 0.5) * 0.08,
    }
end

local dOrbitData = {}
for i = 1, #orbitSwords do
    dOrbitData[i] = {
        angleX = math.random() * math.pi * 2,
        angleY = math.random() * math.pi * 2,
        angleZ = math.random() * math.pi * 2,
        speedX = (math.random() - 0.5) * 0.07,
        speedY = (math.random() - 0.5) * 0.05,
        speedZ = (math.random() - 0.5) * 0.07,
    }
end

print("Old: " .. #oldSwords .. " | Orbit: " .. #orbitSwords)

local function updateLabel()
    local g = wingMode and "G✅" or "G❌"
    local h = haloMode and "H✅" or "H❌"
    local j = jMode and "J✅" or "J❌"
    local t = tMode and "T✅" or "T❌"
    local r = rMode and "R✅" or "R❌"
    local d = dMode and "D✅" or "D❌"
    local x = xMode and "X✅" or "X❌"
    local c = cMode and "C✅" or "C❌"
    local z = zMode and "Z✅" or "Z❌"
    modeLabel.Text = "[" .. g .. "][" .. h .. "][" .. j .. "][" .. t .. "][" .. r .. "][" .. d .. "][" .. x .. "][" .. c .. "][" .. z .. "]"
    modeLabel.TextColor3 = (wingMode or haloMode or jMode or tMode or rMode or dMode or xMode or cMode or zMode)
        and Color3.fromRGB(0, 210, 90)
        or Color3.fromRGB(150, 150, 170)
end

local function setupXMode()
    xSwordAssignments = {}
    local otherPlayers = {}
    for _, p in ipairs(Players:GetPlayers()) do
        if p ~= player then table.insert(otherPlayers, p) end
    end
    for i, p in ipairs(otherPlayers) do
        if i <= #oldSwords then
            xSwordAssignments[i] = {
                targetPlayer = p,
                angleX = math.random() * math.pi * 2,
                angleY = math.random() * math.pi * 2,
                speedX = (math.random() - 0.5) * 0.1,
                speedY = (math.random() - 0.5) * 0.1,
                radius = 6,
            }
        end
    end
end

local function realFling(targetChar)
    local targetHRP = targetChar:FindFirstChild("HumanoidRootPart")
    if not targetHRP then return end
    if flingCooldowns[targetChar.Name] then return end
    flingCooldowns[targetChar.Name] = true
    task.spawn(function()
        local att = Instance.new("Attachment", targetHRP)
        local vf = Instance.new("VectorForce", targetHRP)
        vf.Attachment0 = att
        vf.RelativeTo = Enum.ActuatorRelativeTo.World
        local dir = (targetHRP.Position - hrp.Position).Unit
        vf.Force = Vector3.new(dir.X * 800000, 500000, dir.Z * 800000)
        task.wait(0.1)
        vf:Destroy()
        att:Destroy()
        task.wait(1)
        flingCooldowns[targetChar.Name] = nil
    end)
end

UserInputService.InputBegan:Connect(function(input, gpe)
    if gpe then return end
    if input.KeyCode == Enum.KeyCode.G then
        wingMode = not wingMode
        if wingMode then haloMode=false jMode=false tMode=false rMode=false dMode=false xMode=false cMode=false zMode=false end
        updateLabel()
    elseif input.KeyCode == Enum.KeyCode.H then
        haloMode = not haloMode
        if haloMode then wingMode=false jMode=false tMode=false rMode=false dMode=false xMode=false cMode=false zMode=false end
        updateLabel()
    elseif input.KeyCode == Enum.KeyCode.J then
        jMode = not jMode
        if jMode then
            wingMode=false haloMode=false tMode=false rMode=false dMode=false xMode=false cMode=false zMode=false
            setupJAngles(#oldSwords)
        end
        updateLabel()
    elseif input.KeyCode == Enum.KeyCode.T then
        tMode = not tMode
        if tMode then wingMode=false haloMode=false jMode=false rMode=false dMode=false xMode=false cMode=false zMode=false end
        updateLabel()
    elseif input.KeyCode == Enum.KeyCode.R then
        rMode = not rMode
        if rMode then wingMode=false haloMode=false jMode=false tMode=false dMode=false xMode=false cMode=false zMode=false end
        updateLabel()
    elseif input.KeyCode == Enum.KeyCode.D then
        dMode = not dMode
        if dMode then wingMode=false haloMode=false jMode=false tMode=false rMode=false xMode=false cMode=false zMode=false end
        updateLabel()
    elseif input.KeyCode == Enum.KeyCode.X then
        xMode = not xMode
        if xMode then
            wingMode=false haloMode=false jMode=false tMode=false rMode=false dMode=false cMode=false zMode=false
            setupXMode()
        end
        updateLabel()
    elseif input.KeyCode == Enum.KeyCode.C then
        cMode = not cMode
        if cMode then wingMode=false haloMode=false jMode=false tMode=false rMode=false dMode=false xMode=false zMode=false end
        updateLabel()
    elseif input.KeyCode == Enum.KeyCode.Z then
        zMode = not zMode
        if zMode then wingMode=false haloMode=false jMode=false tMode=false rMode=false dMode=false xMode=false cMode=false end
        updateLabel()
    elseif input.KeyCode == Enum.KeyCode.L then
        colorGui.Enabled = not colorGui.Enabled
    end
end)

task.spawn(function()
    local wingSine = 0
    local prevLoudness = 0
    local beatPulse = 0
    -- ✨ NEW: bounce tracking
    local bouncePulse = 0

    while running do
        angle = angle + settings.orbitSpeed
        haloAngle = haloAngle + settings.orbitSpeed
        wingSine = wingSine + 1

        local activeSnd = boomboxSound.IsPlaying and boomboxSound or sound
        local rawLoudness = activeSnd.PlaybackLoudness

        -- BEAT DETECTION
        local loudnessDelta = rawLoudness - prevLoudness
        local isBeat = loudnessDelta > 80

        if isBeat then
            beatPulse = math.min(loudnessDelta / 3, 30)
            bouncePulse = 1.0  -- ✨ full bounce on beat
            firePixelationBurst()  -- ✨ trigger Pixelation burst on beat
        else
            beatPulse = beatPulse * 0.85
            bouncePulse = bouncePulse * 0.75  -- ✨ decay bounce
        end
        prevLoudness = rawLoudness

        local loudness = rawLoudness / settings.beatSensitivity
        -- ✨ beatRadius now includes the bounce snap outward
        local beatRadius = settings.beatRange + loudness + beatPulse + bouncePulse * 4
        local beatHeight = settings.orbitHeight + loudness * 0.5 + beatPulse * 0.3

        local hrpPos = hrp.Position
        local rayParams = RaycastParams.new()
        rayParams.FilterDescendantsInstances = {character}
        rayParams.FilterType = Enum.RaycastFilterType.Exclude
        local groundRay = workspace:Raycast(hrpPos, Vector3.new(0, -10, 0), rayParams)
        local groundY = groundRay and groundRay.Position.Y or (hrpPos.Y - 3)

        for i, part in ipairs(vizParts) do
            local a = (2 * math.pi / VIZ_COUNT) * (i - 1)
            local wave = math.sin(wingSine * 0.15 + i * 0.4)
            local barHeight = math.clamp(0.3 + (rawLoudness / 50) * (0.5 + wave * 0.5), 0.3, 12)
            local x = hrpPos.X + math.cos(a) * VIZ_RADIUS
            local z = hrpPos.Z + math.sin(a) * VIZ_RADIUS
            local y = groundY + barHeight / 2
            part.Size = Vector3.new(0.35, barHeight, 0.35)
            part.CFrame = CFrame.new(x, y, z)
            part.Color = Color3.fromHSV(((i / VIZ_COUNT) + wingSine * 0.003) % 1, 1, 1)
        end

        local orbitTotal = #orbitSwords
        for i, data in ipairs(orbitSwords) do
            if data.attachB and data.attachB.Parent then
                if dMode then
                    local dd = dOrbitData[i]
                    dd.angleX = dd.angleX + dd.speedX
                    dd.angleY = dd.angleY + dd.speedY
                    dd.angleZ = dd.angleZ + dd.speedZ
                    local x = math.sin(dd.angleY) * math.cos(dd.angleX) * beatRadius
                    local y = math.sin(dd.angleX) * beatHeight * 0.5 + beatHeight
                    local z = math.cos(dd.angleY) * math.cos(dd.angleZ) * beatRadius
                    data.attachB.Position = Vector3.new(x, y, z)
                    data.attachB.Orientation = Vector3.new(math.deg(dd.angleX), math.deg(dd.angleY), math.deg(dd.angleZ))
                else
                    local a = angle + (2 * math.pi / orbitTotal) * (i - 1)
                    data.attachB.Position = Vector3.new(
                        math.cos(a) * beatRadius,
                        math.sin(angle * 2 + i) * 0.5 + beatHeight,
                        math.sin(a) * beatRadius
                    )
                    data.attachB.Orientation = Vector3.new(0, math.deg(a), 45)
                end
            end
        end

        local oldTotal = #oldSwords
        for i, data in ipairs(oldSwords) do
            if data.attachB and data.attachB.Parent then
                if wingMode then
                    local wp = wingPositions[i] or wingPositions[#wingPositions]
                    local flap = math.sin(wingSine / 30) * 0.3
                    data.attachB.Position = Vector3.new(wp[1], wp[2] + flap, wp[3])
                    data.attachB.Orientation = Vector3.new(wp[4], wp[5], wp[6] + flap * 3)

                elseif haloMode then
                    local a = haloAngle + (2 * math.pi / oldTotal) * (i - 1)
                    data.attachB.Position = Vector3.new(math.cos(a) * 3, math.sin(a) * 3 + 2, 2)
                    data.attachB.Orientation = Vector3.new(0, 0, math.deg(a) + 90)

                elseif jMode then
                    local sa = jSphereAngles[i]
                    if sa then
                        local rotatedPhi = sa.phi + angle * 2
                        local x = math.sin(sa.theta) * math.cos(rotatedPhi) * beatRadius
                        local y = math.cos(sa.theta) * beatRadius + beatHeight
                        local z = math.sin(sa.theta) * math.sin(rotatedPhi) * beatRadius
                        data.attachB.Position = Vector3.new(x, y, z)
                        data.attachB.Orientation = Vector3.new(math.deg(sa.theta), math.deg(rotatedPhi), 0)
                    end

                elseif tMode then
                    local a = haloAngle + (2 * math.pi / oldTotal) * (i - 1)
                    data.attachB.Position = Vector3.new(math.cos(a) * 3.5, 7, math.sin(a) * 3.5)
                    data.attachB.Orientation = Vector3.new(90, math.deg(a), 0)

                elseif rMode then
                    local sp = starPositions[i] or starPositions[#starPositions]
                    data.attachB.Position = Vector3.new(sp[1], sp[2], sp[3])
                    data.attachB.Orientation = Vector3.new(sp[4], sp[5], sp[6])

                elseif dMode then
                    local dd = dSwordData[i]
                    dd.angleX = dd.angleX + dd.speedX
                    dd.angleY = dd.angleY + dd.speedY
                    dd.angleZ = dd.angleZ + dd.speedZ
                    local x = math.sin(dd.angleY) * math.cos(dd.angleX) * beatRadius
                    local y = math.sin(dd.angleX) * beatHeight * 0.5 + beatHeight
                    local z = math.cos(dd.angleY) * math.cos(dd.angleZ) * beatRadius
                    data.attachB.Position = Vector3.new(x, y, z)
                    data.attachB.Orientation = Vector3.new(math.deg(dd.angleX), math.deg(dd.angleY), math.deg(dd.angleZ))

                elseif xMode then
                    local assignment = xSwordAssignments[i]
                    if assignment then
                        local targetPlayer = assignment.targetPlayer
                        local targetChar = targetPlayer and targetPlayer.Character
                        local targetHRP = targetChar and targetChar:FindFirstChild("HumanoidRootPart")
                        if targetHRP then
                            assignment.angleX = assignment.angleX + assignment.speedX
                            assignment.angleY = assignment.angleY + assignment.speedY
                            local targetPos = targetHRP.Position
                            local rx = math.cos(assignment.angleY) * assignment.radius
                            local ry = math.sin(assignment.angleX) * 3 + 3
                            local rz = math.sin(assignment.angleY) * assignment.radius
                            local worldPos = targetPos + Vector3.new(rx, ry, rz)
                            local localPos = hrp.CFrame:PointToObjectSpace(worldPos)
                            data.attachB.Position = localPos
                            data.attachB.Orientation = Vector3.new(math.deg(assignment.angleX), math.deg(assignment.angleY), 0)
                        end
                    else
                        local a = angle + (2 * math.pi / oldTotal) * (i - 1)
                        data.attachB.Position = Vector3.new(
                            math.cos(a) * beatRadius,
                            math.sin(angle * 2 + i) * 0.5 + beatHeight,
                            math.sin(a) * beatRadius
                        )
                        data.attachB.Orientation = Vector3.new(0, math.deg(a), 45)
                    end

                elseif cMode then
                    local a = angle * 10 + (2 * math.pi / oldTotal) * (i - 1)
                    local sx = math.cos(a) * beatRadius
                    local sy = math.sin(a * 1.5) * 3 + beatHeight * 0.5
                    local sz = math.sin(a) * beatRadius
                    data.attachB.Position = Vector3.new(sx, sy, sz)
                    data.attachB.Orientation = Vector3.new(math.deg(a * 2), math.deg(a), math.deg(a * 3))
                    local swordWorldPos = hrp.CFrame:PointToWorldSpace(Vector3.new(sx, sy, sz))
                    for _, p in ipairs(Players:GetPlayers()) do
                        if p ~= player and p.Character then
                            local pHRP = p.Character:FindFirstChild("HumanoidRootPart")
                            if pHRP then
                                local dist = (swordWorldPos - pHRP.Position).Magnitude
                                if dist < 4 then realFling(p.Character) end
                            end
                        end
                    end

                elseif zMode then
                    local half = math.ceil(oldTotal / 2)
                    local groupAngle = angle + (math.pi / half) * (i - 1)
                    if i <= half then
                        data.attachB.Position = Vector3.new(
                            math.cos(groupAngle) * beatRadius,
                            math.sin(groupAngle) * beatRadius + beatHeight,
                            0
                        )
                        data.attachB.Orientation = Vector3.new(0, math.deg(groupAngle), math.deg(groupAngle) + 90)
                    else
                        data.attachB.Position = Vector3.new(
                            0,
                            math.sin(groupAngle) * beatRadius + beatHeight,
                            math.cos(groupAngle) * beatRadius
                        )
                        data.attachB.Orientation = Vector3.new(math.deg(groupAngle) + 90, 0, math.deg(groupAngle))
                    end

                else
                    local a = angle + (2 * math.pi / oldTotal) * (i - 1)
                    data.attachB.Position = Vector3.new(
                        math.cos(a) * beatRadius,
                        math.sin(angle * 2 + i) * 0.5 + beatHeight,
                        math.sin(a) * beatRadius
                    )
                    data.attachB.Orientation = Vector3.new(0, math.deg(a), 45)
                end
            end
        end

        task.wait(0.03)
    end
end)

_G.SwordFloatCleanup = function()
    running = false
    for _, data in ipairs(allSwordsList) do
        pcall(function()
            data.alignPos:Destroy()
            data.alignOri:Destroy()
            data.attachA:Destroy()
            data.attachB:Destroy()
            if data.trail then data.trail:Destroy() end
            if data.trailAtt0 then data.trailAtt0:Destroy() end
            if data.trailAtt1 then data.trailAtt1:Destroy() end
        end)
    end
    oldSwords = {}
    orbitSwords = {}
    allSwordsList = {}
    boomboxSound:Destroy()
    vizFolder:Destroy()
    pixelFolder:Destroy()
    pcall(function() flashGui:Destroy() end)
    print("Cleaned up!")
end

print("✅ G=Wing | H=Halo | J=Sphere | T=Crown | R=StarBurst | D=Chaos | X=PlayerOrbit | C=Fling | Z=XOrbit | L=TrailColor | 🌈 Trails + Hard Beat + ▣ PIXELATION VFX ON!")

Features & Information

75757866019626 try this music Also say -net on the chat after the execute Also thx to my dawg who use with for ts 💔

Community Comments (2)

test243322test243322Jun 28, 2026

Can you get rid of the screen glistening effect when the song is playing?

sonik_rafciosonik_rafcioAug 6, 2026

wydm

More Scripts for Universal Scripts