velocity but i skidded it
Key RequiredUniversal

velocity but i skidded it

Universal Scriptalsotwentycharactersalsotwentycharacters 26 views 14 executesUpdated Jul 23, 2026
Unrated
00
Lua Script•1229 lines (49730 chars)
--made by wortexios
--im not affiliated with velocity
local TweenService     = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")
local Players          = game:GetService("Players")

local isMobile = UserInputService.TouchEnabled and not UserInputService.KeyboardEnabled

local funScripts = {
    { Name = "Infinite Yield FE.lua",
      src  = [[loadstring(game:HttpGet("https://raw.githubusercontent.com/EdgeIY/infiniteyield/master/source"))()]] },
    { Name = "Sirius.lua",
      src  = [[loadstring(game:HttpGet('https://sirius.menu/sirius'))()]] },
}

local favScripts = {
    { Name = "Dark Dex.lua",
      src  = [[loadstring(game:HttpGet("https://raw.githubusercontent.com/infyiff/backup/main/dex.lua"))()]] },
    { Name = "Hydroxide.lua",
      src  = [[
local owner = "Upbolt"
local branch = "revision"
local function webImport(file)
    return loadstring(game:HttpGetAsync(
        ("https://raw.githubusercontent.com/%s/Hydroxide/%s/%s.lua"):format(owner, branch, file)
    ), file..".lua")()
end
webImport("init")
webImport("ui/main")
]] },
}

local FOLDER       = "Sodium"
local TABS_FOLDER  = "Sodium/Tabs"
local LOGS_FOLDER  = "Sodium/SavedLogs"

if not isfolder(FOLDER)      then makefolder(FOLDER)      end
if not isfolder(TABS_FOLDER) then makefolder(TABS_FOLDER) end
if not isfolder(LOGS_FOLDER) then makefolder(LOGS_FOLDER) end

local function saveTabToDisk(name, code)
    local safeName = name:gsub("[/\\:*?\"<>|]", "_")
    writefile(TABS_FOLDER .. "/" .. safeName, code or "")
end

local function loadTabFromDisk(name)
    local safeName = name:gsub("[/\\:*?\"<>|]", "_")
    local path = TABS_FOLDER .. "/" .. safeName
    if isfile(path) then return readfile(path) end
    return nil
end

local W  = isMobile and 620  or 920
local H  = isMobile and 420  or 620
local FS = isMobile and 11   or 13

local ScreenGui = Instance.new("ScreenGui")
ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
ScreenGui.Parent         = gethui()

local Frame = Instance.new("CanvasGroup")
Frame.AnchorPoint      = Vector2.new(0.5, 0.5)
Frame.Name             = "Frame"
Frame.Position         = UDim2.new(0.5, 0, 0.5, 0)
Frame.Size             = UDim2.fromOffset(W, H)
Frame.BorderSizePixel  = 0
Frame.BackgroundColor3 = Color3.fromRGB(8, 8, 8)
Frame.Parent           = ScreenGui

local UIShadow = Instance.new("UIShadow")
UIShadow.Offset      = UDim2.fromOffset(2, 2)
UIShadow.Transparency = 0.28
UIShadow.BlurRadius  = UDim.new(0, 3)
UIShadow.Parent      = Frame

local TOPBAR_H = isMobile and 28 or 35

local TopBar = Instance.new("Frame")
TopBar.AnchorPoint      = Vector2.new(0.5, 0)
TopBar.Name             = "TopBar"
TopBar.Position         = UDim2.new(0.5, 0, 0, 0)
TopBar.Size             = UDim2.fromOffset(W, TOPBAR_H)
TopBar.BorderSizePixel  = 0
TopBar.BackgroundColor3 = Color3.fromRGB(8, 8, 8)
TopBar.Parent           = Frame

local TopBarStroke = Instance.new("UIStroke")
TopBarStroke.Color  = Color3.fromRGB(25, 25, 25)
TopBarStroke.Parent = TopBar

local VeloLogo = Instance.new("ImageLabel")
VeloLogo.Name                  = "VeloLogo"
VeloLogo.AnchorPoint           = Vector2.new(0, 0.5)
VeloLogo.Image                 = "rbxassetid://111116614471209"
VeloLogo.BackgroundTransparency = 1
VeloLogo.Position              = UDim2.new(0.008, 0, 0.5, 0)
VeloLogo.Size                  = UDim2.fromOffset(isMobile and 18 or 24, isMobile and 18 or 24)
VeloLogo.ImageColor3           = Color3.fromRGB(179, 179, 179)
VeloLogo.Parent                = TopBar

local VersionLabel = Instance.new("TextLabel")
VersionLabel.TextWrapped         = true
VersionLabel.TextColor3          = Color3.fromRGB(127, 127, 127)
VersionLabel.Text                = "Sodium  1.2.9b"
VersionLabel.Name                = "Version"
VersionLabel.Size                = UDim2.fromOffset(160, 16)
VersionLabel.AnchorPoint         = Vector2.new(0.5, 0.5)
VersionLabel.Position            = UDim2.new(0.5, 0, 0.5, 0)
VersionLabel.BackgroundTransparency = 1
VersionLabel.Font                = Enum.Font.SourceSansSemibold
VersionLabel.TextSize            = FS
VersionLabel.Parent              = TopBar

local ButtonsContainer = Instance.new("Frame")
ButtonsContainer.AnchorPoint         = Vector2.new(1, 0)
ButtonsContainer.BackgroundTransparency = 1
ButtonsContainer.Position            = UDim2.new(1, 0, 0, 0)
ButtonsContainer.Name                = "ButtonsContainer"
ButtonsContainer.Size                = UDim2.fromOffset(135, TOPBAR_H)
ButtonsContainer.Parent              = TopBar

local BCLayout = Instance.new("UIListLayout")
BCLayout.FillDirection       = Enum.FillDirection.Horizontal
BCLayout.HorizontalAlignment = Enum.HorizontalAlignment.Right
BCLayout.SortOrder           = Enum.SortOrder.LayoutOrder
BCLayout.Parent              = ButtonsContainer

local function makeWinBtn(name, imgId, order)
    local btn = Instance.new("ImageButton")
    btn.Name                  = name
    btn.AutoButtonColor       = false
    btn.AnchorPoint           = Vector2.new(1, 0)
    btn.BackgroundTransparency = 1
    btn.Size                  = UDim2.fromOffset(45, TOPBAR_H)
    btn.BorderSizePixel       = 0
    btn.BackgroundColor3      = (name == "Exit") and Color3.fromRGB(232, 17, 35) or Color3.fromRGB(57, 57, 57)
    btn.LayoutOrder           = order
    btn.Parent                = ButtonsContainer
    local ico = Instance.new("ImageLabel")
    ico.ScaleType              = Enum.ScaleType.Fit
    ico.Name                   = "ico"
    ico.AnchorPoint            = Vector2.new(0.5, 0.5)
    ico.Image                  = imgId
    ico.BackgroundTransparency = 1
    ico.Position               = UDim2.new(0.5, 0, 0.5, 0)
    ico.Size                   = UDim2.fromOffset(19, 19)
    ico.Parent                 = btn
    return btn
end

local Exit     = makeWinBtn("Exit",     "rbxassetid://104385908921328", 1)
local Maximize = makeWinBtn("Maximize", "rbxassetid://110549229595156", 2)
local Minimize = makeWinBtn("Minimize", "rbxassetid://88396938293530",  3)

for _, btn in ipairs({Exit, Maximize, Minimize}) do
    btn.MouseEnter:Connect(function() btn.BackgroundTransparency = 0 end)
    btn.MouseLeave:Connect(function() btn.BackgroundTransparency = 1 end)
end

local isMinimized = false
local isMaximized = false
local savedSize   = Frame.Size
local savedPos    = Frame.Position

local minimizedBar = Instance.new("Frame")
minimizedBar.Name             = "MinimizedBar"
minimizedBar.AnchorPoint      = Vector2.new(0.5, 1)
minimizedBar.Position         = UDim2.new(0.5, 0, 1, -8)
minimizedBar.Size             = UDim2.fromOffset(W, 4)
minimizedBar.BackgroundColor3 = Color3.fromRGB(92, 93, 94)
minimizedBar.BorderSizePixel  = 0
minimizedBar.Visible          = false
minimizedBar.ZIndex           = 20
minimizedBar.Parent           = TopBar

local MinBarCorner = Instance.new("UICorner")
MinBarCorner.CornerRadius = UDim.new(0, 2)
MinBarCorner.Parent       = minimizedBar

Exit.MouseButton1Click:Connect(function()
    for _, v in ipairs(listfiles(TABS_FOLDER)) do
        local name = v:match("[^/\\]+$")
        if name then
            local code = curSel and curSel.Name == name and curSel.CodeBox.Text or readfile(v)
            writefile(TABS_FOLDER .. "/" .. name, code)
        end
    end
    ScreenGui:Destroy()
end)

Minimize.MouseButton1Click:Connect(function()
    isMinimized = not isMinimized
    if isMinimized then
        Frame.Size             = UDim2.fromOffset(W, TOPBAR_H)
        minimizedBar.Visible   = true
        Minimize.ico.Image     = "rbxassetid://88396938293530"
    else
        Frame.Size             = isMaximized and UDim2.fromScale(1, 1) or savedSize
        minimizedBar.Visible   = false
    end
end)

Maximize.MouseButton1Click:Connect(function()
    if isMinimized then return end
    isMaximized = not isMaximized
    if isMaximized then
        savedSize         = Frame.Size
        savedPos          = Frame.Position
        Frame.Size        = UDim2.fromScale(1, 1)
        Frame.Position    = UDim2.fromOffset(0, 0)
        Frame.AnchorPoint = Vector2.new(0, 0)
    else
        Frame.AnchorPoint = Vector2.new(0.5, 0.5)
        Frame.Size        = savedSize
        Frame.Position    = savedPos
    end
end)

local EXPL_W = isMobile and 200 or 310

local SearchExplorer = Instance.new("Frame")
SearchExplorer.AnchorPoint      = Vector2.new(0.5, 0)
SearchExplorer.Name             = "SearchExplorer"
SearchExplorer.Position         = UDim2.new(0.168, -1, 0.056, 0)
SearchExplorer.Size             = UDim2.fromOffset(EXPL_W, isMobile and 30 or 41)
SearchExplorer.BorderSizePixel  = 0
SearchExplorer.BackgroundColor3 = Color3.fromRGB(8, 8, 8)
SearchExplorer.Parent           = Frame

local SEStroke = Instance.new("UIStroke")
SEStroke.Color  = Color3.fromRGB(25, 25, 25)
SEStroke.Parent = SearchExplorer

local SearchIco = Instance.new("ImageLabel")
SearchIco.Name                  = "SearchIco"
SearchIco.AnchorPoint           = Vector2.new(0, 0.5)
SearchIco.Image                 = "rbxassetid://122086195900803"
SearchIco.BackgroundTransparency = 1
SearchIco.Position              = UDim2.new(0.021, 0, 0.5, 0)
SearchIco.Size                  = UDim2.fromOffset(isMobile and 16 or 24, isMobile and 16 or 24)
SearchIco.Parent                = SearchExplorer

local SearchInp = Instance.new("TextBox")
SearchInp.AnchorPoint           = Vector2.new(0, 0.5)
SearchInp.PlaceholderColor3     = Color3.fromRGB(72, 72, 72)
SearchInp.TextColor3            = Color3.fromRGB(180, 180, 180)
SearchInp.PlaceholderText       = "Search scripts..."
SearchInp.TextSize              = FS
SearchInp.Size                  = UDim2.fromOffset(EXPL_W - 50, 16)
SearchInp.Text                  = ""
SearchInp.Position              = UDim2.new(0.126, 0, 0.5, 0)
SearchInp.CursorPosition        = -1
SearchInp.BackgroundTransparency = 1
SearchInp.TextXAlignment        = Enum.TextXAlignment.Left
SearchInp.ClearTextOnFocus      = false
SearchInp.Font                  = Enum.Font.SourceSans
SearchInp.Parent                = SearchExplorer

local Explorer = Instance.new("Frame")
Explorer.AnchorPoint      = Vector2.new(0.5, 1)
Explorer.Name             = "Explorer"
Explorer.Position         = UDim2.new(0.168, -1, 1, 1)
Explorer.Size             = UDim2.fromOffset(EXPL_W, H - TOPBAR_H - (isMobile and 30 or 41) - 1)
Explorer.BorderSizePixel  = 0
Explorer.BackgroundColor3 = Color3.fromRGB(8, 8, 8)
Explorer.Parent           = Frame

local ExplStroke = Instance.new("UIStroke")
ExplStroke.Color  = Color3.fromRGB(25, 25, 25)
ExplStroke.Parent = Explorer

local ExplLayout = Instance.new("UIListLayout")
ExplLayout.SortOrder = Enum.SortOrder.LayoutOrder
ExplLayout.Parent    = Explorer

local OUT_H = isMobile and 90 or 129

local Output = Instance.new("Frame")
Output.AnchorPoint      = Vector2.new(0.5, 1)
Output.Name             = "Output"
Output.Position         = UDim2.new(0.6677, 0, 1, 0)
Output.Size             = UDim2.fromOffset(W - EXPL_W, OUT_H)
Output.BorderSizePixel  = 0
Output.BackgroundColor3 = Color3.fromRGB(8, 8, 8)
Output.Parent           = Frame

local OutStroke = Instance.new("UIStroke")
OutStroke.Color  = Color3.fromRGB(25, 25, 25)
OutStroke.Parent = Output

local OutTop = Instance.new("Frame")
OutTop.Name                  = "Top"
OutTop.BackgroundTransparency = 1
OutTop.Position              = UDim2.new(0, 0, 0.05, 0)
OutTop.Size                  = UDim2.fromOffset(W - EXPL_W - 10, 26)
OutTop.Parent                = Output

local OutHeader = Instance.new("TextLabel")
OutHeader.TextWrapped         = true
OutHeader.Name                = "header"
OutHeader.TextColor3          = Color3.fromRGB(180, 180, 180)
OutHeader.Text                = "Output"
OutHeader.Size                = UDim2.fromOffset(123, 18)
OutHeader.Position            = UDim2.new(0.02, 0, 0.5, 0)
OutHeader.AnchorPoint         = Vector2.new(0, 0.5)
OutHeader.BackgroundTransparency = 1
OutHeader.TextXAlignment      = Enum.TextXAlignment.Left
OutHeader.Font                = Enum.Font.SourceSansSemibold
OutHeader.TextSize            = FS + 1
OutHeader.Parent              = OutTop

local OutButtons = Instance.new("Frame")
OutButtons.AnchorPoint         = Vector2.new(1, 0)
OutButtons.BackgroundTransparency = 1
OutButtons.Position            = UDim2.new(0.98, 0, 0, 0)
OutButtons.Name                = "Buttons"
OutButtons.Size                = UDim2.fromOffset(247, 26)
OutButtons.Parent              = OutTop

local OBLayout = Instance.new("UIListLayout")
OBLayout.VerticalAlignment  = Enum.VerticalAlignment.Center
OBLayout.FillDirection       = Enum.FillDirection.Horizontal
OBLayout.HorizontalAlignment = Enum.HorizontalAlignment.Right
OBLayout.Padding             = UDim.new(0, 10)
OBLayout.SortOrder           = Enum.SortOrder.LayoutOrder
OBLayout.Parent              = OutButtons

local function makeOutBtn(name, imgId, order)
    local btn = Instance.new("ImageButton")
    btn.ImageColor3           = Color3.fromRGB(124, 124, 124)
    btn.Image                 = imgId
    btn.BackgroundTransparency = 1
    btn.Name                  = name
    btn.Size                  = UDim2.fromOffset(20, 20)
    btn.LayoutOrder           = order
    btn.Parent                = OutButtons
    return btn
end

local ClearOut    = makeOutBtn("Clear",    "rbxassetid://100367491115342", 4)
local CopyOut     = makeOutBtn("Copy",     "rbxassetid://86878545872893",  3)
local SaveOut     = makeOutBtn("Save",     "rbxassetid://87857444303979",  2)
local SettingsOut = makeOutBtn("Settings", "rbxassetid://111467744253591", 1)

local ContainerOut = Instance.new("ScrollingFrame")
ContainerOut.Active                = true
ContainerOut.AnchorPoint           = Vector2.new(0.5, 1)
ContainerOut.BorderSizePixel       = 0
ContainerOut.Size                  = UDim2.fromOffset(W - EXPL_W - 20, OUT_H - 36)
ContainerOut.ScrollBarImageColor3  = Color3.fromRGB(57, 57, 57)
ContainerOut.ScrollBarThickness    = 8
ContainerOut.CanvasSize            = UDim2.fromOffset(0, 0)
ContainerOut.AutomaticCanvasSize   = Enum.AutomaticSize.Y
ContainerOut.Name                  = "Container"
ContainerOut.BackgroundTransparency = 1
ContainerOut.Position              = UDim2.new(0.5095, 0, 1, 0)
ContainerOut.Parent                = Output

local COLayout = Instance.new("UIListLayout")
COLayout.SortOrder = Enum.SortOrder.LayoutOrder
COLayout.Parent    = ContainerOut

local MAIN_BTN_H = isMobile and 30 or 39

local MainButtons = Instance.new("Frame")
MainButtons.AnchorPoint      = Vector2.new(0.5, 1)
MainButtons.Name             = "MainButtons"
MainButtons.Position         = UDim2.new(0.6677, 0, 0.792, 0)
MainButtons.Size             = UDim2.fromOffset(W - EXPL_W, MAIN_BTN_H)
MainButtons.BorderSizePixel  = 0
MainButtons.BackgroundColor3 = Color3.fromRGB(8, 8, 8)
MainButtons.Parent           = Frame

local MBStroke = Instance.new("UIStroke")
MBStroke.Color  = Color3.fromRGB(25, 25, 25)
MBStroke.Parent = MainButtons

local LeftSide = Instance.new("Frame")
LeftSide.BackgroundTransparency = 1
LeftSide.Name                   = "LeftSideContainer"
LeftSide.Size                   = UDim2.fromOffset(isMobile and 330 or 452, MAIN_BTN_H)
LeftSide.Parent                 = MainButtons

local LSLayout = Instance.new("UIListLayout")
LSLayout.FillDirection = Enum.FillDirection.Horizontal
LSLayout.SortOrder     = Enum.SortOrder.LayoutOrder
LSLayout.Parent        = LeftSide

local function makeEditorBtn(name, imgId, labelText, w, order, parent)
    local btn = Instance.new("ImageButton")
    btn.BackgroundTransparency = 1
    btn.Name             = name
    btn.Size             = UDim2.fromOffset(w, MAIN_BTN_H)
    btn.LayoutOrder      = order
    btn.Parent           = parent
    local ico = Instance.new("ImageLabel")
    ico.ImageColor3           = Color3.fromRGB(124, 124, 124)
    ico.Name                  = "Ico"
    ico.AnchorPoint           = Vector2.new(0, 0.5)
    ico.Image                 = imgId
    ico.BackgroundTransparency = 1
    ico.Position              = UDim2.new(0.14, 0, 0.5, 0)
    ico.Size                  = UDim2.fromOffset(17, 17)
    ico.Parent                = btn
    local lbl = Instance.new("TextLabel")
    lbl.TextWrapped       = true
    lbl.Name              = "Title"
    lbl.TextColor3        = Color3.fromRGB(127, 127, 127)
    lbl.Text              = labelText
    lbl.Size              = UDim2.fromOffset(name == "Execute" and 57 or 51, 20)
    lbl.Position          = UDim2.new(name == "Execute" and 0.362 or 0.437, 0, 0.5, 0)
    lbl.AnchorPoint       = Vector2.new(0, 0.5)
    lbl.BackgroundTransparency = 1
    lbl.TextXAlignment    = Enum.TextXAlignment.Left
    lbl.Font              = Enum.Font.SourceSansSemibold
    lbl.TextSize          = FS
    lbl.TextScaled        = true
    lbl.Parent            = btn
    return btn
end

local Execute = makeEditorBtn("Execute", "rbxassetid://108000317098010", "Execute", isMobile and 75 or 95, 1, LeftSide)
local Clear   = makeEditorBtn("Clear",   "rbxassetid://118287937709636", "Clear",   isMobile and 60 or 80, 2, LeftSide)
local Open    = makeEditorBtn("Open",    "rbxassetid://95730417142188",  "Open",    isMobile and 60 or 80, 3, LeftSide)
local Save    = makeEditorBtn("Save",    "rbxassetid://87857444303979",  "Save",    isMobile and 60 or 80, 4, LeftSide)
local Inject  = makeEditorBtn("Inject",  "rbxassetid://126199288541761", "Inject",  isMobile and 60 or 80, 1, MainButtons)

Inject.AnchorPoint = Vector2.new(1, 0)
Inject.Position    = UDim2.new(0.98, 0, 0, 0)
Inject.LayoutOrder = 0

local TAB_H = isMobile and 30 or 39

local TabsContainer = Instance.new("Frame")
TabsContainer.AnchorPoint         = Vector2.new(1, 0)
TabsContainer.BackgroundTransparency = 1
TabsContainer.Position            = UDim2.new(1, 0, 0.059, 0)
TabsContainer.Name                = "TabsContainer"
TabsContainer.Size                = UDim2.fromOffset(W - EXPL_W, TAB_H)
TabsContainer.Parent              = Frame

local TabScrollFrame = Instance.new("ScrollingFrame")
TabScrollFrame.Active                 = true
TabScrollFrame.BorderSizePixel        = 0
TabScrollFrame.CanvasSize             = UDim2.fromOffset(0, 0)
TabScrollFrame.AutomaticCanvasSize    = Enum.AutomaticSize.X
TabScrollFrame.ScrollBarImageColor3   = Color3.fromRGB(57, 57, 57)
TabScrollFrame.ScrollBarThickness     = 8
TabScrollFrame.Name                   = "Container"
TabScrollFrame.BackgroundTransparency = 1
TabScrollFrame.Size                   = UDim2.fromOffset(W - EXPL_W - 37, TAB_H)
TabScrollFrame.ClipsDescendants       = true
TabScrollFrame.Parent                 = TabsContainer

local TSFLayout = Instance.new("UIListLayout")
TSFLayout.FillDirection = Enum.FillDirection.Horizontal
TSFLayout.SortOrder     = Enum.SortOrder.LayoutOrder
TSFLayout.Parent        = TabScrollFrame

local NewTab = Instance.new("ImageButton")
NewTab.ImageColor3           = Color3.fromRGB(96, 97, 99)
NewTab.Name                  = "NewTab"
NewTab.AnchorPoint           = Vector2.new(0.5, 0.5)
NewTab.Image                 = "rbxassetid://137135197793108"
NewTab.BackgroundTransparency = 1
NewTab.Position              = UDim2.new(0.962, 0, 0.5, 0)
NewTab.Size                  = UDim2.fromOffset(23, 23)
NewTab.Parent                = TabsContainer

local EDITOR_H = H - TOPBAR_H - TAB_H - MAIN_BTN_H - OUT_H

local EditorFrame = Instance.new("Frame")
EditorFrame.AnchorPoint      = Vector2.new(1, 1)
EditorFrame.Name             = "EditorFrame"
EditorFrame.Position         = UDim2.new(1, 0, 0.728, 0)
EditorFrame.Size             = UDim2.fromOffset(W - EXPL_W, EDITOR_H)
EditorFrame.BorderSizePixel  = 0
EditorFrame.BackgroundColor3 = Color3.fromRGB(10, 10, 10)
EditorFrame.Parent           = Frame

local OpenFile = Instance.new("Frame")
OpenFile.AnchorPoint      = Vector2.new(0.5, 0.5)
OpenFile.Name             = "OpenFile"
OpenFile.Position         = UDim2.new(0.5, 0, 0.5, 0)
OpenFile.Size             = UDim2.fromOffset(392, 120)
OpenFile.ZIndex           = 15
OpenFile.BorderSizePixel  = 0
OpenFile.BackgroundColor3 = Color3.fromRGB(8, 8, 8)
OpenFile.Visible          = false
OpenFile.Parent           = ScreenGui

local OFStroke = Instance.new("UIStroke")
OFStroke.Color  = Color3.fromRGB(25, 25, 25)
OFStroke.Parent = OpenFile

local OFShadow = Instance.new("UIShadow")
OFShadow.Offset      = UDim2.fromOffset(2, 2)
OFShadow.Transparency = 0.28
OFShadow.BlurRadius  = UDim.new(0, 3)
OFShadow.Parent      = OpenFile

local OFHatch = Instance.new("TextLabel")
OFHatch.TextWrapped         = true
OFHatch.TextColor3          = Color3.fromRGB(127, 127, 127)
OFHatch.Text                = "Enter File Path"
OFHatch.Size                = UDim2.fromOffset(141, 23)
OFHatch.AnchorPoint         = Vector2.new(0.5, 0.5)
OFHatch.Position            = UDim2.new(0.5, 0, 0.217, 0)
OFHatch.BackgroundTransparency = 1
OFHatch.Font                = Enum.Font.SourceSans
OFHatch.TextSize            = 14
OFHatch.TextScaled          = true
OFHatch.Parent              = OpenFile

local OFInpBox = Instance.new("Frame")
OFInpBox.AnchorPoint      = Vector2.new(0.5, 0.5)
OFInpBox.Name             = "inpbox"
OFInpBox.Position         = UDim2.new(0.5, 0, 0.65, 0)
OFInpBox.Size             = UDim2.fromOffset(306, 36)
OFInpBox.BackgroundColor3 = Color3.fromRGB(10, 10, 10)
OFInpBox.Parent           = OpenFile

local OFIStroke = Instance.new("UIStroke")
OFIStroke.Color  = Color3.fromRGB(25, 25, 25)
OFIStroke.Parent = OFInpBox

local OFPrefix = Instance.new("TextLabel")
OFPrefix.TextWrapped         = true
OFPrefix.TextColor3          = Color3.fromRGB(127, 127, 127)
OFPrefix.Text                = "Workspace/"
OFPrefix.Size                = UDim2.fromOffset(81, 20)
OFPrefix.Position            = UDim2.new(0.186, 0, 0.5, 0)
OFPrefix.AnchorPoint         = Vector2.new(0.5, 0.5)
OFPrefix.BackgroundTransparency = 1
OFPrefix.TextXAlignment      = Enum.TextXAlignment.Left
OFPrefix.TextScaled          = true
OFPrefix.Font                = Enum.Font.SourceSans
OFPrefix.Parent              = OFInpBox

local FileInput = Instance.new("TextBox")
FileInput.AnchorPoint           = Vector2.new(0.5, 0.5)
FileInput.PlaceholderColor3     = Color3.fromRGB(127, 127, 127)
FileInput.PlaceholderText       = "..."
FileInput.TextSize              = 14
FileInput.Size                  = UDim2.fromOffset(194, 20)
FileInput.TextColor3            = Color3.fromRGB(208, 208, 208)
FileInput.Text                  = ""
FileInput.Name                  = "FileInput"
FileInput.Position              = UDim2.new(0.636, 0, 0.5, 0)
FileInput.BackgroundTransparency = 1
FileInput.TextXAlignment        = Enum.TextXAlignment.Left
FileInput.ClearTextOnFocus      = false
FileInput.TextScaled            = true
FileInput.Font                  = Enum.Font.SourceSans
FileInput.Parent                = OFInpBox

do
    local dragging, dragStart, startPos
    TopBar.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1
        or input.UserInputType == Enum.UserInputType.Touch then
            dragging  = true
            dragStart = input.Position
            startPos  = Frame.Position
            input.Changed:Connect(function()
                if input.UserInputState == Enum.UserInputState.End then dragging = false end
            end)
        end
    end)
    TopBar.InputChanged:Connect(function(input)
        if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement
        or input.UserInputType == Enum.UserInputType.Touch) then
            local d = input.Position - dragStart
            Frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + d.X,
                                       startPos.Y.Scale, startPos.Y.Offset + d.Y)
        end
    end)
end

for _, btn in ipairs({Execute, Clear, Open, Save, Inject}) do
    local isExec = btn.Name == "Execute"
    btn.MouseEnter:Connect(function()
        btn.Title.TextColor3 = Color3.fromRGB(203, 203, 203)
        btn.Ico.ImageColor3  = Color3.fromRGB(203, 203, 203)
        btn.Title:TweenPosition(
            isExec and UDim2.new(0.362,0,0.42,0) or UDim2.new(0.437,0,0.42,0),
            Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.1, true)
        btn.Ico:TweenPosition(UDim2.new(0.14,0,0.42,0),
            Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.1, true)
    end)
    btn.MouseLeave:Connect(function()
        btn.Title.TextColor3 = Color3.fromRGB(127, 127, 127)
        btn.Ico.ImageColor3  = Color3.fromRGB(124, 124, 124)
        btn.Title:TweenPosition(
            isExec and UDim2.new(0.362,0,0.5,0) or UDim2.new(0.437,0,0.5,0),
            Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.1, true)
        btn.Ico:TweenPosition(UDim2.new(0.14,0,0.5,0),
            Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.1, true)
    end)
end

for _, btn in ipairs({ClearOut, CopyOut, SaveOut, SettingsOut, NewTab}) do
    btn.MouseEnter:Connect(function() btn.ImageColor3 = Color3.fromRGB(203, 203, 203) end)
    btn.MouseLeave:Connect(function() btn.ImageColor3 = Color3.fromRGB(124, 124, 124) end)
end

local logOrder = 0
local function AddLog(txt)
    logOrder += 1
    local ts  = os.date("!%H:%M:%S")
    local lbl = Instance.new("TextLabel")
    lbl.RichText             = true
    lbl.Name                 = "Log"
    lbl.TextColor3           = Color3.fromRGB(255, 255, 255)
    lbl.Text                 = ('<font color="#afafaf">[%s] - </font>%s'):format(ts, txt)
    lbl.Size                 = UDim2.fromOffset(W - EXPL_W - 30, 17)
    lbl.BorderSizePixel      = 0
    lbl.TextSize             = FS
    lbl.BackgroundTransparency = 1
    lbl.TextXAlignment       = Enum.TextXAlignment.Left
    lbl.TextWrapped          = true
    lbl.Font                 = Enum.Font.Code
    lbl.TextScaled           = true
    lbl.LayoutOrder          = logOrder
    lbl.Parent               = ContainerOut
    task.defer(function()
        ContainerOut.CanvasPosition = Vector2.new(0, math.huge)
    end)
end

local keywords = {
    ["local"]=true,["function"]=true,["end"]=true,["if"]=true,["then"]=true,
    ["else"]=true,["elseif"]=true,["return"]=true,["for"]=true,["while"]=true,
    ["do"]=true,["repeat"]=true,["until"]=true,["true"]=true,["false"]=true,
    ["nil"]=true,["and"]=true,["or"]=true,["not"]=true,["break"]=true,
    ["in"]=true,["continue"]=true,
}
local hlColors = {
    keyword="#d62279", string="#54e89c", comment="#666666",
    number="#d6ac22",  default="#c2c2c2",
}
local typeColors = {
    ["function"]="#b688f2",["table"]="#b688f2",["userdata"]="#2b91af",
    ["number"]="#d6ac22",["string"]="#54e89c",["boolean"]="#d62279",["nil"]="#d62279",
}

local function esc(s)
    return s:gsub("&","&amp;"):gsub("<","&lt;"):gsub(">","&gt;")
end

local function wordColor(w)
    local ok, val = pcall(function() return getfenv()[w] end)
    if ok and val ~= nil then return typeColors[typeof(val)] end
end

local function highlightLine(line)
    local cs = line:find("%-%-")
    local code, cmt = line, nil
    if cs then code = line:sub(1,cs-1); cmt = line:sub(cs) end
    local out = {}
    local i, len = 1, #code
    while i <= len do
        local c = code:sub(i,i)
        if c == '"' or c == "'" then
            local q, j = c, i+1
            while j <= len and code:sub(j,j) ~= q do
                if code:sub(j,j) == "\\" then j += 1 end
                j += 1
            end
            out[#out+1] = ('<font color="%s">%s</font>'):format(hlColors.string, esc(code:sub(i,math.min(j,len))))
            i = j+1; continue
        end
        local word, sep = code:match("^([%w_]*)([^%w_]?)", i)
        if word ~= "" then
            local col = keywords[word] and hlColors.keyword
                     or (tonumber(word) and hlColors.number)
                     or wordColor(word)
                     or hlColors.default
            out[#out+1] = ('<font color="%s">%s</font>'):format(col, esc(word))
            i += #word
        end
        if sep ~= "" then out[#out+1] = esc(sep); i += 1
        elseif word == "" then i += 1 end
    end
    if cmt then
        out[#out+1] = ('<font color="%s">%s</font>'):format(hlColors.comment, esc(cmt))
    end
    return table.concat(out)
end

local curSel = nil

local function makeCodebox(sectName, src)
    for _, v in ipairs(EditorFrame:GetChildren()) do v.Visible = false end

    local Container = Instance.new("ScrollingFrame")
    Container.Active               = true
    Container.AnchorPoint          = Vector2.new(0, 1)
    Container.BorderSizePixel      = 0
    Container.CanvasSize           = UDim2.fromOffset(0, 0)
    Container.ScrollBarImageColor3 = Color3.fromRGB(57, 57, 57)
    Container.ScrollBarThickness   = 14
    Container.Name                 = sectName
    Container.Size                 = UDim2.fromOffset(W - EXPL_W, EDITOR_H)
    Container.Position             = UDim2.new(0, 0, 1, 0)
    Container.BackgroundTransparency = 1
    Container.Parent               = EditorFrame

    local Cursor = Instance.new("Frame")
    Cursor.Size             = UDim2.fromOffset(2, 16)
    Cursor.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
    Cursor.BorderSizePixel  = 0
    Cursor.ZIndex           = 5
    Cursor.Visible          = false
    Cursor.Parent           = Container
    TweenService:Create(Cursor, TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.In, -1, true, 0.01), {BackgroundTransparency=1}):Play()

    local LineCount = Instance.new("TextLabel")
    LineCount.Font               = Enum.Font.Code
    LineCount.TextColor3         = Color3.fromRGB(255, 255, 255)
    LineCount.Text               = "1"
    LineCount.Name               = "LineCount"
    LineCount.Size               = UDim2.fromOffset(26, 16)
    LineCount.Position           = UDim2.new(0.012, 0, 0, 0)
    LineCount.BackgroundTransparency = 1
    LineCount.RichText           = true
    LineCount.TextYAlignment     = Enum.TextYAlignment.Top
    LineCount.TextSize           = 16
    LineCount.Parent             = Container

    local CodeBox = Instance.new("TextBox")
    CodeBox.MultiLine           = true
    CodeBox.CursorPosition      = -1
    CodeBox.ZIndex              = 3
    CodeBox.TextSize            = 16
    CodeBox.Size                = UDim2.fromOffset(W - EXPL_W - 60, 16)
    CodeBox.TextColor3          = Color3.fromRGB(255, 255, 255)
    CodeBox.TextTransparency    = 1
    CodeBox.Text                = src or ""
    CodeBox.Name                = "CodeBox"
    CodeBox.Font                = Enum.Font.Code
    CodeBox.Position            = UDim2.new(0.0895, 0, 0, 0)
    CodeBox.BackgroundTransparency = 1
    CodeBox.TextXAlignment      = Enum.TextXAlignment.Left
    CodeBox.TextWrapped         = false
    CodeBox.ClearTextOnFocus    = false
    CodeBox.TextYAlignment      = Enum.TextYAlignment.Top
    CodeBox.Parent              = Container

    local HighlightLabel = Instance.new("TextLabel")
    HighlightLabel.ZIndex              = 2
    HighlightLabel.TextSize            = 16
    HighlightLabel.Size                = UDim2.fromOffset(W - EXPL_W - 60, 16)
    HighlightLabel.RichText            = true
    HighlightLabel.TextColor3          = Color3.fromRGB(255, 255, 255)
    HighlightLabel.Text                = ""
    HighlightLabel.Name                = "HighlightLabel"
    HighlightLabel.Font                = Enum.Font.Code
    HighlightLabel.Position            = CodeBox.Position
    HighlightLabel.BackgroundTransparency = 1
    HighlightLabel.TextXAlignment      = Enum.TextXAlignment.Left
    HighlightLabel.TextYAlignment      = Enum.TextYAlignment.Top
    HighlightLabel.TextWrapped         = false
    HighlightLabel.Parent              = Container

    local Measurer = Instance.new("TextLabel")
    Measurer.Name          = "Measurer"
    Measurer.Visible       = false
    Measurer.AutomaticSize = Enum.AutomaticSize.X
    Measurer.Size          = UDim2.fromOffset(0, 16)
    Measurer.TextSize      = CodeBox.TextSize
    Measurer.Font          = CodeBox.Font
    Measurer.Text          = ""
    Measurer.Parent        = Container

    local LineOutline = Instance.new("Frame")
    LineOutline.Active              = true
    LineOutline.Name                = "LineOutline"
    LineOutline.BackgroundTransparency = 1
    LineOutline.Position            = UDim2.new(0.0895, 0, 0, 0)
    LineOutline.Size                = UDim2.fromOffset(W - EXPL_W - 60, 18)
    LineOutline.Selectable          = true
    LineOutline.ZIndex              = 1
    LineOutline.Parent              = Container

    local LOStroke = Instance.new("UIStroke")
    LOStroke.Color     = Color3.fromRGB(40, 40, 40)
    LOStroke.Thickness = 2
    LOStroke.Parent    = LineOutline

    local function getLineNumber(text, cur)
        if cur <= 0 then return 1 end
        local _, n = text:sub(1, cur-1):gsub("\n","\n")
        return n+1
    end

    local function getCurrentLineAndCol(text, cur)
        if cur <= 0 then return 1, "" end
        local before = text:sub(1, cur-1)
        local lineStart, lineNum = 1, 1
        for p in before:gmatch("()\n") do lineNum += 1; lineStart = p+1 end
        return lineNum, before:sub(lineStart)
    end

    local function updateCursor()
        local cur = CodeBox.CursorPosition
        if cur == -1 then Cursor.Visible = false; return end
        local lineNum, col = getCurrentLineAndCol(CodeBox.Text, cur)
        Measurer.Text = col
        Cursor.Position = UDim2.new(CodeBox.Position.X.Scale,
            CodeBox.Position.X.Offset + Measurer.TextBounds.X,
            0, (lineNum-1)*16)
        Cursor.Visible = true
    end

    local function refresh()
        local lines = {}
        for line in (CodeBox.Text.."\n"):gmatch("(.-)\n") do
            lines[#lines+1] = highlightLine(line)
        end
        HighlightLabel.Text = table.concat(lines, "\n")
    end

    local function updateSize()
        local _, n = CodeBox.Text:gsub("\n","\n")
        local h = (n+1)*16
        CodeBox.Size        = UDim2.fromOffset(CodeBox.Size.X.Offset, h)
        HighlightLabel.Size = UDim2.fromOffset(HighlightLabel.Size.X.Offset, h)
        LineCount.Size      = UDim2.fromOffset(LineCount.Size.X.Offset, h)
        Container.CanvasSize = UDim2.fromOffset(0, h)
    end

    local function updateLineCount()
        local _, total = CodeBox.Text:gsub("\n","\n")
        total += 1
        local active = getLineNumber(CodeBox.Text, CodeBox.CursorPosition)
        local nums = {}
        for n = 1, total do
            nums[n] = ('<font color="%s">%d</font>'):format(
                n == active and "rgb(198,198,198)" or "rgb(133,133,133)", n)
        end
        LineCount.Text = table.concat(nums, "\n")
    end

    local function updateLineOutline()
        local cur = CodeBox.CursorPosition
        if cur == -1 then return end
        local ln = getLineNumber(CodeBox.Text, cur)
        LineOutline.Position = UDim2.new(LineOutline.Position.X.Scale,
            LineOutline.Position.X.Offset, 0, (ln-1)*16-1)
    end

    local function autosave()
        saveTabToDisk(sectName, CodeBox.Text)
    end

    CodeBox.Focused:Connect(function()  Cursor.Visible = true; updateCursor() end)
    CodeBox.FocusLost:Connect(function() Cursor.Visible = false; autosave() end)

    CodeBox:GetPropertyChangedSignal("CursorPosition"):Connect(function()
        updateCursor(); updateLineOutline(); updateLineCount()
    end)
    CodeBox:GetPropertyChangedSignal("Text"):Connect(function()
        refresh(); updateCursor(); updateLineCount(); updateSize(); updateLineOutline()
    end)

    refresh(); updateLineCount(); updateSize(); updateLineOutline()
end

local lastTab = 0

local function makeTab(tabName, src)
    for _, v in ipairs(TabScrollFrame:GetChildren()) do
        if v:IsA("ImageButton") then
            if v:FindFirstChild("Toggled") then v.Toggled.Visible = false end
            v.BackgroundTransparency = 1
        end
    end

    if EditorFrame:FindFirstChild(tabName) then
        for _, v in ipairs(EditorFrame:GetChildren()) do v.Visible = false end
        EditorFrame[tabName].Visible = true
        curSel = EditorFrame[tabName]
        for _, v in ipairs(TabScrollFrame:GetChildren()) do
            if v:IsA("ImageButton") and v.Name == tabName then
                if v:FindFirstChild("Toggled") then v.Toggled.Visible = true end
                v.BackgroundTransparency = 0
            end
        end
        return
    end

    local TabBtn = Instance.new("ImageButton")
    TabBtn.Name                   = tabName
    TabBtn.Size                   = UDim2.fromOffset(144, TAB_H + 2)
    TabBtn.BackgroundColor3       = Color3.fromRGB(10, 10, 10)
    TabBtn.BackgroundTransparency = 0
    TabBtn.Parent                 = TabScrollFrame

    local Toggled = Instance.new("Frame")
    Toggled.Name             = "Toggled"
    Toggled.Size             = UDim2.fromOffset(144, 2)
    Toggled.BackgroundColor3 = Color3.fromRGB(92, 93, 94)
    Toggled.Visible          = true
    Toggled.Parent           = TabBtn

    local TabIco = Instance.new("ImageLabel")
    TabIco.ImageColor3           = Color3.fromRGB(169, 169, 169)
    TabIco.ScaleType             = Enum.ScaleType.Fit
    TabIco.Name                  = "ico"
    TabIco.AnchorPoint           = Vector2.new(0.5, 0.5)
    TabIco.Image                 = "rbxassetid://103251760765538"
    TabIco.BackgroundTransparency = 1
    TabIco.Position              = UDim2.new(0.14, 0, 0.5, 0)
    TabIco.Size                  = UDim2.fromOffset(13, 16)
    TabIco.Parent                = TabBtn

    local CloseBtn = Instance.new("ImageButton")
    CloseBtn.ImageColor3           = Color3.fromRGB(55, 55, 55)
    CloseBtn.ScaleType             = Enum.ScaleType.Fit
    CloseBtn.Active                = false
    CloseBtn.Name                  = "CloseBtn"
    CloseBtn.Size                  = UDim2.fromOffset(12, 12)
    CloseBtn.AnchorPoint           = Vector2.new(0.5, 0.5)
    CloseBtn.Image                 = "rbxassetid://79010788760505"
    CloseBtn.BackgroundTransparency = 1
    CloseBtn.Position              = UDim2.new(0.868, 0, 0.5, 0)
    CloseBtn.Selectable            = false
    CloseBtn.Parent                = TabBtn

    local Title = Instance.new("TextLabel")
    Title.TextWrapped         = true
    Title.Name                = "Title"
    Title.TextColor3          = Color3.fromRGB(208, 208, 208)
    Title.Text                = tabName
    Title.Size                = UDim2.fromOffset(76, 15)
    Title.Position            = UDim2.new(0.23, 0, 0.5, 0)
    Title.AnchorPoint         = Vector2.new(0, 0.5)
    Title.BackgroundTransparency = 1
    Title.TextXAlignment      = Enum.TextXAlignment.Left
    Title.TextScaled          = true
    Title.Font                = Enum.Font.SourceSans
    Title.TextTruncate        = Enum.TextTruncate.AtEnd
    Title.Parent              = TabBtn

    local diskSrc = loadTabFromDisk(tabName)
    makeCodebox(tabName, diskSrc or src)
    curSel = EditorFrame[tabName]
    saveTabToDisk(tabName, diskSrc or src or "")

    local lastClick = 0
    TabBtn.MouseButton1Down:Connect(function()
        local now = tick()
        if now - lastClick < 0.35 then
            if curSel ~= EditorFrame:FindFirstChild(TabBtn.Name) then lastClick = now; return end
            local renameBox = Instance.new("TextBox")
            renameBox.BackgroundColor3  = Color3.fromRGB(20, 20, 20)
            renameBox.BorderSizePixel   = 0
            renameBox.Size              = UDim2.fromOffset(76, 15)
            renameBox.Position          = Title.Position
            renameBox.AnchorPoint       = Title.AnchorPoint
            renameBox.Text              = Title.Text
            renameBox.TextColor3        = Color3.fromRGB(255, 255, 255)
            renameBox.TextSize          = 13
            renameBox.Font              = Enum.Font.SourceSans
            renameBox.ClearTextOnFocus  = false
            renameBox.ZIndex            = 6
            renameBox.Parent            = TabBtn
            renameBox:CaptureFocus()
            renameBox.FocusLost:Connect(function()
                local trimmed = renameBox.Text:match("^%s*(.-)%s*$")
                if trimmed ~= "" then
                    if not trimmed:match("%.lua$") then trimmed ..= ".lua" end
                    local cb = EditorFrame:FindFirstChild(TabBtn.Name)
                    local oldName = TabBtn.Name
                    if cb then
                        local code = cb:FindFirstChild("CodeBox") and cb.CodeBox.Text or ""
                        saveTabToDisk(trimmed, code)
                        local oldSafe = oldName:gsub("[/\\:*?\"<>|]", "_")
                        local oldPath = TABS_FOLDER .. "/" .. oldSafe
                        if isfile(oldPath) then delfile(oldPath) end
                        cb.Name = trimmed
                    end
                    TabBtn.Name = trimmed
                    Title.Text  = trimmed
                    AddLog('Renamed to "' .. trimmed .. '".')
                end
                renameBox:Destroy()
            end)
        end
        lastClick = now
    end)

    TabBtn.MouseButton1Click:Connect(function()
        for _, v in ipairs(EditorFrame:GetChildren()) do v.Visible = false end
        for _, v in ipairs(TabScrollFrame:GetChildren()) do
            if v:IsA("ImageButton") then
                if v:FindFirstChild("Toggled") then v.Toggled.Visible = false end
                v.BackgroundTransparency = 1
            end
        end
        local target = EditorFrame:FindFirstChild(TabBtn.Name)
        if target then target.Visible = true; curSel = target end
        Toggled.Visible               = true
        TabBtn.BackgroundTransparency = 0
    end)

    CloseBtn.MouseButton1Click:Connect(function()
        local cb = EditorFrame:FindFirstChild(TabBtn.Name)
        if cb then
            local code = cb:FindFirstChild("CodeBox") and cb.CodeBox.Text or ""
            saveTabToDisk(TabBtn.Name, code)
            cb:Destroy()
        end
        TabBtn:Destroy()

        local remaining = {}
        for _, v in ipairs(TabScrollFrame:GetChildren()) do
            if v:IsA("ImageButton") then remaining[#remaining+1] = v end
        end
        if #remaining > 0 then
            local first = remaining[1]
            for _, v in ipairs(EditorFrame:GetChildren()) do v.Visible = false end
            for _, v in ipairs(TabScrollFrame:GetChildren()) do
                if v:IsA("ImageButton") then
                    if v:FindFirstChild("Toggled") then v.Toggled.Visible = false end
                    v.BackgroundTransparency = 1
                end
            end
            local target = EditorFrame:FindFirstChild(first.Name)
            if target then target.Visible = true; curSel = target end
            if first:FindFirstChild("Toggled") then first.Toggled.Visible = true end
            first.BackgroundTransparency = 0
        else
            curSel = nil
        end
    end)

    CloseBtn.MouseEnter:Connect(function() CloseBtn.ImageColor3 = Color3.fromRGB(203, 203, 203) end)
    CloseBtn.MouseLeave:Connect(function() CloseBtn.ImageColor3 = Color3.fromRGB(55, 55, 55)    end)
end

NewTab.MouseButton1Click:Connect(function()
    lastTab += 1
    makeTab("New Tab " .. tostring(lastTab) .. ".lua")
end)

local ExplorerFuncs = {}

function ExplorerFuncs:AddHeader(sectName, order)
    local el = Instance.new("Frame")
    el.BackgroundTransparency = 1
    el.Name        = sectName
    el.Size        = UDim2.fromOffset(EXPL_W - 1, 45)
    el.LayoutOrder = order
    el.Parent      = Explorer
    local lbl = Instance.new("TextLabel")
    lbl.TextWrapped         = true
    lbl.TextColor3          = Color3.fromRGB(127, 127, 127)
    lbl.Text                = sectName
    lbl.Size                = UDim2.fromOffset(EXPL_W - 50, 12)
    lbl.Position            = UDim2.new(0.061, 0, 0.5, 0)
    lbl.AnchorPoint         = Vector2.new(0, 0.5)
    lbl.BackgroundTransparency = 1
    lbl.TextXAlignment      = Enum.TextXAlignment.Left
    lbl.TextScaled          = true
    lbl.Font                = Enum.Font.SourceSansSemibold
    lbl.Parent              = el
end

function ExplorerFuncs:AddScript(scriptName, imgId, src, order)
    local el = Instance.new("Frame")
    el.BackgroundTransparency = 1
    el.Name        = scriptName
    el.Size        = UDim2.fromOffset(EXPL_W - 1, 40)
    el.LayoutOrder = order
    el.Parent      = Explorer

    local Btn = Instance.new("ImageButton")
    Btn.AutoButtonColor      = false
    Btn.AnchorPoint          = Vector2.new(0.5, 0.5)
    Btn.BackgroundTransparency = 1
    Btn.Position             = UDim2.new(0.511, 0, 0.5, 0)
    Btn.Size                 = UDim2.fromOffset(EXPL_W - 35, 34)
    Btn.BackgroundColor3     = Color3.fromRGB(21, 21, 21)
    Btn.Parent               = el

    local BtnCorner = Instance.new("UICorner")
    BtnCorner.CornerRadius = UDim.new(0, 6)
    BtnCorner.Parent       = Btn

    local ico = Instance.new("ImageLabel")
    ico.AnchorPoint           = Vector2.new(0.5, 0.5)
    ico.Image                 = imgId
    ico.BackgroundTransparency = 1
    ico.Position              = UDim2.new(0.07, 0, 0.5, 0)
    ico.Size                  = UDim2.fromOffset(23, 23)
    ico.Parent                = Btn

    local lbl = Instance.new("TextLabel")
    lbl.TextWrapped         = true
    lbl.TextColor3          = Color3.fromRGB(198, 198, 198)
    lbl.Text                = scriptName
    lbl.Size                = UDim2.fromOffset(EXPL_W - 80, 14)
    lbl.Position            = UDim2.new(0.141, 0, 0.5, 0)
    lbl.AnchorPoint         = Vector2.new(0, 0.5)
    lbl.BackgroundTransparency = 1
    lbl.TextXAlignment      = Enum.TextXAlignment.Left
    lbl.TextScaled          = true
    lbl.Font                = Enum.Font.SourceSans
    lbl.Parent              = Btn

    Btn.MouseEnter:Connect(function()  Btn.BackgroundTransparency = 0 end)
    Btn.MouseLeave:Connect(function()  Btn.BackgroundTransparency = 1 end)
    Btn.MouseButton1Down:Connect(function() makeTab(scriptName, src) end)
end

local function BuildExplorer()
    for _, v in ipairs(Explorer:GetChildren()) do
        if not v:IsA("UIListLayout") then v:Destroy() end
    end
    local order = 1
    ExplorerFuncs:AddHeader("FAVOURITES", order); order += 1
    for _, v in ipairs(favScripts) do
        ExplorerFuncs:AddScript(v.Name, "rbxassetid://129006243080309", v.src, order)
        order += 1
    end
    ExplorerFuncs:AddHeader("FUN SCRIPTS", order); order += 1
    for _, v in ipairs(funScripts) do
        ExplorerFuncs:AddScript(v.Name, "rbxassetid://75018660065307", v.src, order)
        order += 1
    end
end

BuildExplorer()

SearchInp:GetPropertyChangedSignal("Text"):Connect(function()
    local txt = SearchInp.Text:lower()
    if txt == "" then BuildExplorer(); return end
    for _, v in ipairs(Explorer:GetChildren()) do
        if v:IsA("UIListLayout") then continue end
        if v:FindFirstChildOfClass("TextLabel") then
            local isHeader = v:FindFirstChildOfClass("ImageButton") == nil
            v.Visible = isHeader or v.Name:lower():find(txt, 1, true) ~= nil
        end
    end
end)

Execute.MouseButton1Click:Connect(function()
    if not curSel then AddLog("No tab open."); return end
    local code = curSel.CodeBox.Text
    if code:match("^%s*$") then AddLog("Nothing to execute."); return end
    AddLog("Executing " .. curSel.Name .. "...")
    local chunk, synErr = loadstring(code)
    if not chunk then AddLog("Syntax error: " .. tostring(synErr)); return end
    local ok, runErr = pcall(chunk)
    if ok then AddLog("Executed successfully.")
    else AddLog("Runtime error: " .. tostring(runErr)) end
end)

Clear.MouseButton1Click:Connect(function()
    if curSel then curSel.CodeBox.Text = ""; saveTabToDisk(curSel.Name, "") end
end)

ClearOut.MouseButton1Click:Connect(function()
    for _, v in ipairs(ContainerOut:GetChildren()) do
        if v:IsA("TextLabel") then v:Destroy() end
    end
    logOrder = 0
end)

CopyOut.MouseButton1Click:Connect(function()
    if not setclipboard then AddLog("setclipboard not available."); return end
    local lines = {}
    for _, v in ipairs(ContainerOut:GetChildren()) do
        if v:IsA("TextLabel") then lines[#lines+1] = v.Text end
    end
    setclipboard(table.concat(lines, "\n"))
    AddLog("Copied output to clipboard.")
end)

SaveOut.MouseButton1Click:Connect(function()
    local lines = {}
    for _, v in ipairs(ContainerOut:GetChildren()) do
        if v:IsA("TextLabel") then lines[#lines+1] = v.Text end
    end
    local fileName = tostring(os.time()) .. ".txt"
    writefile(LOGS_FOLDER .. "/" .. fileName, table.concat(lines, "\n"))
    AddLog("Saved log to " .. fileName)
end)

Inject.MouseButton1Click:Connect(function()
    AddLog("Already injected!")
end)

Open.MouseButton1Click:Connect(function()
    OpenFile.Visible = true
    FileInput.Text   = ""
    local con
    con = FileInput.FocusLost:Connect(function(enterPressed)
        if enterPressed then
            OpenFile.Visible = false
            local path = FileInput.Text:match("^%s*(.-)%s*$")
            if isfile(path) then
                local name = path:match("[^/\\]+$") or path
                makeTab(name, readfile(path))
                AddLog("Opened " .. name)
            else
                AddLog("File not found: " .. path)
            end
            con:Disconnect()
        end
    end)
end)

Save.MouseButton1Click:Connect(function()
    if not curSel then AddLog("No tab open."); return end
    local name = curSel.Name
    if not name:match("%.lua$") then name ..= ".lua" end
    local code = curSel.CodeBox.Text
    writefile(name, code)
    saveTabToDisk(curSel.Name, code)
    AddLog("Saved to " .. name)
end)

lastTab = 1
makeTab("New Tab 1.lua")
AddLog("Welcome to Sodium, " .. Players.LocalPlayer.DisplayName)
AddLog("Supported Version: all versions lad")

Features & Information

i skidded velocity yess cuzz

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts