OiHub v3
Key RequiredUniversal

OiHub v3

Universal Scriptcrazyx0910crazyx0910 2.1K views 46 executesUpdated Sep 12, 2025
Unrated
00
Lua Script•779 lines (27774 chars)
-- Key: "Link in discord" ; GetKey => copia DiscordLink

-- =========================
-- CONFIG
-- =========================
local KEY = "OiHub_Key10"
local DiscordLink = "https://discord.gg/EYSvDJGc"

-- =========================
-- SERVICES & REFS
-- =========================
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local StarterGui = game:GetService("StarterGui")
local Workspace = game:GetService("Workspace")

local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")

-- character refs (updated on respawn)
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:FindFirstChildOfClass("Humanoid")
local hrp = character:FindFirstChild("HumanoidRootPart")

local function refreshCharacter()
    character = player.Character
    if character then
        humanoid = character:FindFirstChildOfClass("Humanoid") or character:WaitForChild("Humanoid",10)
        hrp = character:FindFirstChild("HumanoidRootPart") or character:WaitForChild("HumanoidRootPart",10)
    else
        humanoid, hrp = nil, nil
    end
end
refreshCharacter()
player.CharacterAdded:Connect(function()
    refreshCharacter()
end)

-- =========================
-- STATE
-- =========================
local State = {
    fly = false,
    flyKeys = {w=false,a=false,s=false,d=false,space=false,ctrl=false,shift=false},
    flySpeed = 60,
    walkSpeed = 16,
    jumpPower = 50,
    noclip = false,
    antihit = false,
    invisible = false,
    guiOpen = false
}

-- =========================
-- UTIL: notify safe
-- =========================
local function Notify(text, dur)
    pcall(function()
        StarterGui:SetCore("SendNotification", {Title="OiHub", Text = tostring(text), Duration = dur or 2})
    end)
end

-- =========================
-- GUI BUILD
-- =========================
-- remove antigo
local old = playerGui:FindFirstChild("OiHubGUI")
if old then old:Destroy() end

local screenGui = Instance.new("ScreenGui")
screenGui.Name = "OiHubGUI"
screenGui.ResetOnSpawn = false
screenGui.Parent = playerGui

-- main container (centered)
local main = Instance.new("Frame", screenGui)
main.Size = UDim2.new(0,520,0,380)
main.Position = UDim2.new(0.5,-260,0.5,-190)
main.BackgroundColor3 = Color3.fromRGB(29,30,34)
main.BorderSizePixel = 0
local uic = Instance.new("UICorner", main); uic.CornerRadius = UDim.new(0,10)

-- header
local header = Instance.new("Frame", main)
header.Size = UDim2.new(1,0,0,44)
header.Position = UDim2.new(0,0,0,0)
header.BackgroundTransparency = 1

local title = Instance.new("TextLabel", header)
title.Size = UDim2.new(0.6,0,1,0)
title.Position = UDim2.new(0.03,0,0,0)
title.Text = "OiHub 5.0"
title.TextXAlignment = Enum.TextXAlignment.Left
title.TextColor3 = Color3.fromRGB(230,230,230)
title.BackgroundTransparency = 1
title.Font = Enum.Font.GothamBold
title.TextSize = 20

local minimizeBtn = Instance.new("TextButton", header)
minimizeBtn.Size = UDim2.new(0,34,0,28)
minimizeBtn.Position = UDim2.new(1,-80,0,8)
minimizeBtn.Text = "—"
minimizeBtn.Font = Enum.Font.Gotham
minimizeBtn.TextSize = 18
minimizeBtn.BackgroundColor3 = Color3.fromRGB(70,70,70)
local mc = Instance.new("UICorner", minimizeBtn); mc.CornerRadius = UDim.new(0,6)

local closeBtn = Instance.new("TextButton", header)
closeBtn.Size = UDim2.new(0,34,0,28)
closeBtn.Position = UDim2.new(1,-40,0,8)
closeBtn.Text = "X"
closeBtn.Font = Enum.Font.Gotham
closeBtn.TextSize = 18
closeBtn.BackgroundColor3 = Color3.fromRGB(70,70,70)
local cc = Instance.new("UICorner", closeBtn); cc.CornerRadius = UDim.new(0,6)

-- left tabs column
local tabsFrame = Instance.new("Frame", main)
tabsFrame.Size = UDim2.new(0,140,1,-54)
tabsFrame.Position = UDim2.new(0,12,0,54)
tabsFrame.BackgroundColor3 = Color3.fromRGB(38,39,44)
local tc = Instance.new("UICorner", tabsFrame); tc.CornerRadius = UDim.new(0,8)

local tabLayout = Instance.new("UIListLayout", tabsFrame)
tabLayout.Padding = UDim.new(0,6)
tabLayout.SortOrder = Enum.SortOrder.LayoutOrder
tabLayout.Padding = UDim.new(0,8)

-- content pane
local content = Instance.new("Frame", main)
content.Size = UDim2.new(1,-176,1,-64)
content.Position = UDim2.new(0,164,0,54)
content.BackgroundTransparency = 1

-- restore button (shown when minimized)
local restoreBtn = Instance.new("TextButton", screenGui)
restoreBtn.Size = UDim2.new(0,100,0,36)
restoreBtn.Position = UDim2.new(0.05,0,0.9,0)
restoreBtn.Text = "OiHub"
restoreBtn.Font = Enum.Font.GothamBold
restoreBtn.TextSize = 16
restoreBtn.BackgroundColor3 = Color3.fromRGB(45,45,50)
restoreBtn.Visible = false
local rc = Instance.new("UICorner", restoreBtn); rc.CornerRadius = UDim.new(0,8)

-- Key frame overlay (initial)
local keyFrame = Instance.new("Frame", screenGui)
keyFrame.Size = UDim2.new(0,340,0,180)
keyFrame.Position = UDim2.new(0.5,-170,0.5,-90)
keyFrame.BackgroundColor3 = Color3.fromRGB(24,24,28)
local kcur = Instance.new("UICorner", keyFrame); kcur.CornerRadius = UDim.new(0,8)

local ktitle = Instance.new("TextLabel", keyFrame)
ktitle.Size = UDim2.new(1,-24,0,28)
ktitle.Position = UDim2.new(0,12,0,10)
ktitle.BackgroundTransparency = 1
ktitle.Font = Enum.Font.GothamBold
ktitle.TextSize = 18
ktitle.Text = "OiHub - Insira a Key"
ktitle.TextColor3 = Color3.fromRGB(230,230,230)
ktitle.TextXAlignment = Enum.TextXAlignment.Left

local keyBox = Instance.new("TextBox", keyFrame)
keyBox.Size = UDim2.new(0.9,0,0,36)
keyBox.Position = UDim2.new(0.05,0,0,52)
keyBox.PlaceholderText = "Digite a Key..."
keyBox.BackgroundColor3 = Color3.fromRGB(33,33,36)
keyBox.TextColor3 = Color3.fromRGB(240,240,240)
keyBox.ClearTextOnFocus = false
local kbcur = Instance.new("UICorner", keyBox); kbcur.CornerRadius = UDim.new(0,6)

local confirmBtn = Instance.new("TextButton", keyFrame)
confirmBtn.Size = UDim2.new(0.45,0,0,34)
confirmBtn.Position = UDim2.new(0.05,0,0,110)
confirmBtn.Text = "Confirmar"
confirmBtn.Font = Enum.Font.GothamBold
confirmBtn.TextSize = 15
confirmBtn.BackgroundColor3 = Color3.fromRGB(64,160,255)
local cfcur = Instance.new("UICorner", confirmBtn); cfcur.CornerRadius = UDim.new(0,6)

local getKeyBtn = Instance.new("TextButton", keyFrame)
getKeyBtn.Size = UDim2.new(0.45,0,0,34)
getKeyBtn.Position = UDim2.new(0.5,0,0,110)
getKeyBtn.Text = "Get Key"
getKeyBtn.Font = Enum.Font.GothamBold
getKeyBtn.TextSize = 15
getKeyBtn.BackgroundColor3 = Color3.fromRGB(80,80,80)
local gkcur = Instance.new("UICorner", getKeyBtn); gkcur.CornerRadius = UDim.new(0,6)

-- Tabs (buttons)
local function makeTab(text)
    local b = Instance.new("TextButton", tabsFrame)
    b.Size = UDim2.new(1,-16,0,42)
    b.BackgroundColor3 = Color3.fromRGB(45,46,50)
    b.Text = text
    b.Font = Enum.Font.GothamBold
    b.TextSize = 14
    b.TextColor3 = Color3.fromRGB(230,230,230)
    local c = Instance.new("UICorner", b); c.CornerRadius = UDim.new(0,8)
    return b
end

local tabFunctions = makeTab("Funções")
local tabInfo = makeTab("Informações")
local tabServer = makeTab("Server")

-- Content panes
local paneFunctions = Instance.new("Frame", content)
paneFunctions.Size = UDim2.new(1,0,1,0)
paneFunctions.BackgroundTransparency = 1
paneFunctions.Visible = false

local paneInfo = Instance.new("Frame", content)
paneInfo.Size = UDim2.new(1,0,1,0)
paneInfo.BackgroundTransparency = 1
paneInfo.Visible = false

local paneServer = Instance.new("Frame", content)
paneServer.Size = UDim2.new(1,0,1,0)
paneServer.BackgroundTransparency = 1
paneServer.Visible = false

local function switchTo(pane)
    paneFunctions.Visible = false
    paneInfo.Visible = false
    paneServer.Visible = false
    pane.Visible = true
end

tabFunctions.MouseButton1Click:Connect(function() switchTo(paneFunctions) end)
tabInfo.MouseButton1Click:Connect(function() switchTo(paneInfo) end)
tabServer.MouseButton1Click:Connect(function() switchTo(paneServer) end)

-- default
switchTo(paneFunctions)
State.guiOpen = true

-- =========================
-- UI HELPERS: Slider + Toggle + Button factories
-- =========================
local function createLabel(parent, text, ypos)
    local l = Instance.new("TextLabel", parent)
    l.Size = UDim2.new(1,-12,0,20)
    l.Position = UDim2.new(0,6,0,ypos)
    l.BackgroundTransparency = 1
    l.Text = text
    l.TextColor3 = Color3.fromRGB(225,225,225)
    l.Font = Enum.Font.Gotham
    l.TextSize = 13
    l.TextXAlignment = Enum.TextXAlignment.Left
    return l
end

local function createToggleBtn(parent, text, ypos, callback)
    local btn = Instance.new("TextButton", parent)
    btn.Size = UDim2.new(1,-12,0,34)
    btn.Position = UDim2.new(0,6,0,ypos)
    btn.BackgroundColor3 = Color3.fromRGB(60,60,60)
    btn.Font = Enum.Font.GothamBold
    btn.TextSize = 14
    btn.Text = text.." [OFF]"
    local c = Instance.new("UICorner", btn); c.CornerRadius = UDim.new(0,6)
    local on = false
    btn.MouseButton1Click:Connect(function()
        on = not on
        btn.Text = text.." ["..(on and "ON" or "OFF").."]"
        pcall(callback, on)
    end)
    return btn
end

local function createSlider(parent, name, min, max, default, ypos, callback)
    local frame = Instance.new("Frame", parent)
    frame.Size = UDim2.new(1,-12,0,62)
    frame.Position = UDim2.new(0,6,0,ypos)
    frame.BackgroundTransparency = 1

    local label = Instance.new("TextLabel", frame)
    label.Size = UDim2.new(1,0,0,20)
    label.Position = UDim2.new(0,0,0,0)
    label.BackgroundTransparency = 1
    label.Text = name.." ["..tostring(default).."]"
    label.Font = Enum.Font.Gotham
    label.TextSize = 13
    label.TextColor3 = Color3.fromRGB(230,230,230)
    label.TextXAlignment = Enum.TextXAlignment.Left

    local track = Instance.new("Frame", frame)
    track.Size = UDim2.new(1,0,0,12)
    track.Position = UDim2.new(0,0,0,34)
    track.BackgroundColor3 = Color3.fromRGB(80,80,80)
    local trc = Instance.new("UICorner", track); trc.CornerRadius = UDim.new(0,6)

    local knob = Instance.new("Frame", track)
    knob.Size = UDim2.new(0,16,0,16)
    local percent = (default - min) / (max - min)
    knob.Position = UDim2.new(percent, -8, 0, -2)
    knob.BackgroundColor3 = Color3.fromRGB(64,160,255)
    local knc = Instance.new("UICorner", knob); knc.CornerRadius = UDim.new(0,6)
    knob.Active = true

    -- dragging
    local dragging = false
    local function updateFromPos(px)
        local absX = track.AbsolutePosition.X
        local width = track.AbsoluteSize.X
        local p = math.clamp((px - absX) / width, 0, 1)
        local v = math.floor(min + (max - min) * p + 0.5)
        label.Text = name.." ["..tostring(v).."]"
        knob.Position = UDim2.new(p, -8, 0, -2)
        pcall(callback, v)
    end

    knob.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
            dragging = true
            input.Changed:Connect(function()
                if input.UserInputState == Enum.UserInputState.End then dragging = false end
            end)
        end
    end)

    track.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
            updateFromPos(input.Position.X)
        end
    end)

    UserInputService.InputChanged:Connect(function(input)
        if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
            updateFromPos(input.Position.X)
        end
    end)

    return frame, label
end

-- CONTENT: FUNCTIONS tab (using a ScrollingLayout inside)
local funcScroll = Instance.new("ScrollingFrame", paneFunctions)
funcScroll.Size = UDim2.new(1,0,1,0)
funcScroll.BackgroundTransparency = 1
funcScroll.CanvasSize = UDim2.new(0,0,0,0)
funcScroll.ScrollBarThickness = 8
local funcLayout = Instance.new("UIListLayout", funcScroll)
funcLayout.SortOrder = Enum.SortOrder.LayoutOrder
funcLayout.Padding = UDim.new(0,8)

-- Sliders & toggles placed vertically by UIListLayout
local walkFrame, walkLabel = createSlider(funcScroll, "Velocidade (WalkSpeed)", 8, 200, State.walkSpeed, 6, function(v)
    State.walkSpeed = v
    if humanoid then humanoid.WalkSpeed = v end
end)

local jumpFrame, jumpLabel = createSlider(funcScroll, "Pulo (JumpPower)", 20, 300, State.jumpPower, 80, function(v)
    State.jumpPower = v
    if humanoid then humanoid.JumpPower = v end
end)

local flyFrame, flyLabel = createSlider(funcScroll, "Fly Speed", 10, 400, State.flySpeed, 154, function(v)
    State.flySpeed = v
end)

-- Toggles
local tFly = createToggleBtn(funcScroll, "Fly", 0, function(on)
    State.fly = on
    if on then Notify("Fly ativado") else Notify("Fly desativado") end
end)

local tNoclip = createToggleBtn(funcScroll, "Noclip", 0, function(on)
    State.noclip = on
    Notify("Noclip "..(on and "ON" or "OFF"))
end)

local tAnti = createToggleBtn(funcScroll, "AntiHit (ForceField)", 0, function(on)
    State.antihit = on
    if on and character and not character:FindFirstChildOfClass("ForceField") then
        Instance.new("ForceField", character)
    elseif (not on) and character then
        local ff = character:FindFirstChildOfClass("ForceField")
        if ff then ff:Destroy() end
    end
end)

local tInvis = createToggleBtn(funcScroll, "Invisível (local)", 0, function(on)
    State.invisible = on
    Notify("Invisibilidade "..(on and "ON (local)" or "OFF"))
end)

-- small helper to update funcScroll CanvasSize
funcLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
    funcScroll.CanvasSize = UDim2.new(0,0,0, funcLayout.AbsoluteContentSize.Y + 12)
end)

-- INFO pane: tutorial text
local infoLabel = Instance.new("TextLabel", paneInfo)
infoLabel.Size = UDim2.new(1, -12, 1, -12)
infoLabel.Position = UDim2.new(0,6,0,6)
infoLabel.BackgroundTransparency = 1
infoLabel.TextWrapped = true
infoLabel.TextColor3 = Color3.fromRGB(220,220,220)
infoLabel.Font = Enum.Font.Gotham
infoLabel.TextSize = 14
infoLabel.Text = [[Tutorial rápido:
- Use a aba "Funções" para ligar Fly, Noclip, AntiHit e Invisível.
- Arraste os sliders para ajustar Velocidade, Pulo e Fly Speed.
- Fly: use W/A/S/D + Espaço para subir e Ctrl para descer (PC). Em mobile a movimentação horizontal usa o joystick.
- Minimizar mantém um botão "OiHub" na tela.
- Aba "Server" mostra seu nick como pasta no Workspace e permite criar/deletar.
- Key necessária: ]] .. KEY

-- SERVER pane: show folder and controls
local serverLabel = Instance.new("TextLabel", paneServer)
serverLabel.Size = UDim2.new(1,-12,0,24)
serverLabel.Position = UDim2.new(0,6,0,6)
serverLabel.BackgroundTransparency = 1
serverLabel.TextColor3 = Color3.fromRGB(230,230,230)
serverLabel.Font = Enum.Font.GothamBold
serverLabel.TextSize = 14
serverLabel.Text = "Server: " .. player.Name -- using player's nick/name

local serverDesc = Instance.new("TextLabel", paneServer)
serverDesc.Size = UDim2.new(1,-12,0,48)
serverDesc.Position = UDim2.new(0,6,0,36)
serverDesc.BackgroundTransparency = 1
serverDesc.TextWrapped = true
serverDesc.TextColor3 = Color3.fromRGB(200,200,200)
serverDesc.Font = Enum.Font.Gotham
serverDesc.TextSize = 13
serverDesc.Text = "Criador: " .. player.Name .. "\nDiscord: " .. DiscordLink

-- buttons create/delete folder
local function makeServerButton(text, ypos, fn)
    local b = Instance.new("TextButton", paneServer)
    b.Size = UDim2.new(0,200,0,36)
    b.Position = UDim2.new(0,6,0,ypos)
    b.Text = text
    b.Font = Enum.Font.GothamBold
    b.TextSize = 14
    b.BackgroundColor3 = Color3.fromRGB(60,60,60)
    local c = Instance.new("UICorner", b); c.CornerRadius = UDim.new(0,6)
    b.MouseButton1Click:Connect(fn)
    return b
end

local createFolderBtn = makeServerButton("Criar Pasta (Workspace)", 100, function()
    local name = player.Name
    if Workspace:FindFirstChild(name) then Notify("Pasta já existe") return end
    local folder = Instance.new("Folder", Workspace)
    folder.Name = name
    Notify("Pasta criada: " .. name)
end)

local deleteFolderBtn = makeServerButton("Deletar Pasta (Workspace)", 150, function()
    local name = player.Name
    local f = Workspace:FindFirstChild(name)
    if f then f:Destroy(); Notify("Pasta deletada") else Notify("Nenhuma pasta encontrada") end
end)

local refreshFolderBtn = makeServerButton("Recriar Pasta (reset)", 200, function()
    local name = player.Name
    local f = Workspace:FindFirstChild(name)
    if f then f:Destroy() end
    local folder = Instance.new("Folder", Workspace)
    folder.Name = name
    Notify("Pasta recriada")
end)

-- KEY / GetKey
confirmBtn.MouseButton1Click:Connect(function()
    if keyBox.Text == KEY then
        keyFrame.Visible = false
        main.Visible = true
        restoreBtn.Visible = false
        State.guiOpen = true
        Notify("Bem-vindo ao OiHub!")
    else
        Notify("Key inválida!")
    end
end)

getKeyBtn.MouseButton1Click:Connect(function()
    pcall(function() setclipboard(DiscordLink) end)
    Notify("Link do Discord copiado!")
end)

-- Minimize / Restore handlers
minimizeBtn.MouseButton1Click:Connect(function()
    main.Visible = false
    restoreBtn.Visible = true
    State.guiOpen = false
end)
closeBtn.MouseButton1Click:Connect(function()
    main.Visible = false
    restoreBtn.Visible = true
    State.guiOpen = false
end)
restoreBtn.MouseButton1Click:Connect(function()
    main.Visible = true
    restoreBtn.Visible = false
    State.guiOpen = true
end)

-- start hidden until key entered
main.Visible = false

-- =========================
-- CORE LOGIC: Fly / Noclip / Invis / AntiHit
-- =========================

-- fly parts (BodyVelocity + BodyGyro) management
local flyBV, flyBG
local function createFlyParts()
    if not hrp then return end
    if not flyBV or not flyBV.Parent then
        flyBV = Instance.new("BodyVelocity")
        flyBV.Name = "OiHub_FlyBV"
        flyBV.MaxForce = Vector3.new(1e5,1e5,1e5)
        flyBV.Velocity = Vector3.new(0,0,0)
        flyBV.Parent = hrp
    end
    if not flyBG or not flyBG.Parent then
        flyBG = Instance.new("BodyGyro")
        flyBG.Name = "OiHub_FlyBG"
        flyBG.MaxTorque = Vector3.new(1e5,1e5,1e5)
        flyBG.P = 9e4
        flyBG.CFrame = hrp.CFrame
        flyBG.Parent = hrp
    end
end
local function destroyFlyParts()
    if flyBV then pcall(function() flyBV:Destroy() end) end
    if flyBG then pcall(function() flyBG:Destroy() end) end
    flyBV, flyBG = nil, nil
end

-- helper: local invisibility using LocalTransparencyModifier if available, else fallback to Transparency
local function applyInvisibility(enable)
    if not character then return end
    for _, obj in pairs(character:GetDescendants()) do
        if obj:IsA("BasePart") and obj.Name ~= "HumanoidRootPart" then
            pcall(function()
                if obj.LocalTransparencyModifier ~= nil then
                    obj.LocalTransparencyModifier = enable and 1 or 0
                else
                    obj.Transparency = enable and 1 or 0
                end
            end)
        elseif obj:IsA("Accessory") and obj:FindFirstChild("Handle") then
            local h = obj:FindFirstChild("Handle")
            pcall(function()
                if h.LocalTransparencyModifier ~= nil then
                    h.LocalTransparencyModifier = enable and 1 or 0
                else
                    h.Transparency = enable and 1 or 0
                end
            end)
        elseif obj:IsA("Decal") or obj:IsA("Texture") then
            pcall(function()
                if obj.Parent and obj.Parent:IsA("BasePart") and obj.Parent.LocalTransparencyModifier ~= nil then
                    -- decals inherit; leave them
                else
                    obj.Transparency = enable and 1 or 0
                end
            end)
        end
    end
end

-- main loops
RunService.RenderStepped:Connect(function()
    -- refresh hrp/humanoid if needed
    if (not character) or (not hrp) or (not humanoid) then
        refreshCharacter()
    end

    -- FLY behaviour (works PC + mobile)
    if State.fly then
        createFlyParts()
        if flyBG and hrp then
            local cam = workspace.CurrentCamera
            pcall(function() flyBG.CFrame = cam.CFrame end)
        end
        -- direction: PC uses keys, mobile uses MoveDirection for horizontal movement
        local dir = Vector3.new()
        if UserInputService.TouchEnabled then
            if humanoid then dir = dir + humanoid.MoveDirection end
            if State.flyKeys.space then dir = dir + Vector3.new(0,1,0) end
            if State.flyKeys.ctrl then dir = dir + Vector3.new(0,-1,0) end
        else
            local cam = workspace.CurrentCamera
            if State.flyKeys.w then dir = dir + cam.CFrame.LookVector end
            if State.flyKeys.s then dir = dir - cam.CFrame.LookVector end
            if State.flyKeys.a then dir = dir - cam.CFrame.RightVector end
            if State.flyKeys.d then dir = dir + cam.CFrame.RightVector end
            if State.flyKeys.space then dir = dir + Vector3.new(0,1,0) end
            if State.flyKeys.ctrl then dir = dir + Vector3.new(0,-1,0) end
        end
        if flyBV then
            if dir.Magnitude > 0 then
                flyBV.Velocity = dir.Unit * State.flySpeed
            else
                flyBV.Velocity = Vector3.new(0,0,0)
            end
        end
    else
        destroyFlyParts()
    end

    -- invisibility (apply local only)
    if State.invisible then
        applyInvisibility(true)
    else
        applyInvisibility(false)
    end

    -- antiHit: ensure ForceField present while on
    if State.antihit and character then
        if not character:FindFirstChildOfClass("ForceField") then
            Instance.new("ForceField", character)
        end
    else
        if character then
            local ff = character:FindFirstChildOfClass("ForceField")
            if ff then ff:Destroy() end
        end
    end
end)

-- Noclip (Stepped to keep persistent)
RunService.Stepped:Connect(function()
    if State.noclip and character then
        for _, p in pairs(character:GetDescendants()) do
            if p:IsA("BasePart") then
                p.CanCollide = false
            end
        end
    end
end)

-- Input handling for fly keys (PC)
UserInputService.InputBegan:Connect(function(inp, processed)
    if processed then return end
    if inp.UserInputType == Enum.UserInputType.Keyboard then
        local k = inp.KeyCode
        if k == Enum.KeyCode.W then State.flyKeys.w = true end
        if k == Enum.KeyCode.S then State.flyKeys.s = true end
        if k == Enum.KeyCode.A then State.flyKeys.a = true end
        if k == Enum.KeyCode.D then State.flyKeys.d = true end
        if k == Enum.KeyCode.Space then State.flyKeys.space = true end
        if k == Enum.KeyCode.LeftControl or k == Enum.KeyCode.RightControl then State.flyKeys.ctrl = true end
        if k == Enum.KeyCode.LeftShift or k == Enum.KeyCode.RightShift then State.flyKeys.shift = true end
    end
end)
UserInputService.InputEnded:Connect(function(inp)
    if inp.UserInputType == Enum.UserInputType.Keyboard then
        local k = inp.KeyCode
        if k == Enum.KeyCode.W then State.flyKeys.w = false end
        if k == Enum.KeyCode.S then State.flyKeys.s = false end
        if k == Enum.KeyCode.A then State.flyKeys.a = false end
        if k == Enum.KeyCode.D then State.flyKeys.d = false end
        if k == Enum.KeyCode.Space then State.flyKeys.space = false end
        if k == Enum.KeyCode.LeftControl or k == Enum.KeyCode.RightControl then State.flyKeys.ctrl = false end
        if k == Enum.KeyCode.LeftShift or k == Enum.KeyCode.RightShift then State.flyKeys.shift = false end
    end
end)

-- Reapply features after respawn
player.CharacterAdded:Connect(function(char)
    character = char
    refreshCharacter()
    -- reapply states
    if State.antihit then
        if character and not character:FindFirstChildOfClass("ForceField") then
            Instance.new("ForceField", character)
        end
    end
    if State.invisible then
        task.wait(0.1)
        applyInvisibility(true)
    end
    if State.noclip then
        task.wait(0.1)
        for _, p in pairs(character:GetDescendants()) do
            if p:IsA("BasePart") then p.CanCollide = false end
        end
    end
    if State.fly then
        task.wait(0.2)
        createFlyParts()
    end
end)

-- apply initial humanoid values if present
if humanoid then
    humanoid.WalkSpeed = State.walkSpeed
    humanoid.JumpPower = State.jumpPower
end

-- =========================
-- CONNECT UI ELEMENTS: sliders & toggles
-- =========================
-- connect the earlier created slider label callbacks by scanning the created frames:
-- (we created walkFrame/jumpFrame/flyFrame via createSlider above)

-- find frames in funcScroll and attach behavior if not already bound
-- (we already bound behaviors when creating sliders, so nothing extra here)

-- Add some extra buttons in Functions pane: Reset player visuals / Stop all
local resetBtn = Instance.new("TextButton", funcScroll)
resetBtn.Size = UDim2.new(1,-12,0,36)
resetBtn.BackgroundColor3 = Color3.fromRGB(90,90,90)
resetBtn.Text = "Reset Visuals (restore)"
resetBtn.Font = Enum.Font.GothamBold
resetBtn.TextSize = 13
local rc2 = Instance.new("UICorner", resetBtn); rc2.CornerRadius = UDim.new(0,6)
resetBtn.MouseButton1Click:Connect(function()
    -- restore transparencies
    if character then
        for _, obj in pairs(character:GetDescendants()) do
            if obj:IsA("BasePart") then
                pcall(function()
                    if obj.LocalTransparencyModifier ~= nil then
                        obj.LocalTransparencyModifier = 0
                    else
                        obj.Transparency = 0
                    end
                end)
            elseif obj:IsA("Accessory") and obj:FindFirstChild("Handle") then
                local h = obj.Handle
                pcall(function()
                    if h.LocalTransparencyModifier ~= nil then
                        h.LocalTransparencyModifier = 0
                    else
                        h.Transparency = 0
                    end
                end)
            end
        end
    end
    Notify("Visuais restaurados")
end)

local stopAll = Instance.new("TextButton", funcScroll)
stopAll.Size = UDim2.new(1,-12,0,36)
stopAll.BackgroundColor3 = Color3.fromRGB(120,60,60)
stopAll.Text = "Desligar tudo (reset)"
stopAll.Font = Enum.Font.GothamBold
stopAll.TextSize = 13
local sc = Instance.new("UICorner", stopAll); sc.CornerRadius = UDim.new(0,6)
stopAll.MouseButton1Click:Connect(function()
    -- turn off all states and cleanup
    State.fly = false; State.noclip = false; State.antihit = false; State.invisible = false
    destroyFlyParts()
    -- remove forcefield if any
    if character then
        local ff = character:FindFirstChildOfClass("ForceField")
        if ff then ff:Destroy() end
        -- restore visuals
        for _, obj in pairs(character:GetDescendants()) do
            if obj:IsA("BasePart") then
                pcall(function()
                    if obj.LocalTransparencyModifier ~= nil then obj.LocalTransparencyModifier = 0 else obj.Transparency = 0 end
                end)
            elseif obj:IsA("Accessory") and obj:FindFirstChild("Handle") then
                local h = obj.Handle
                pcall(function()
                    if h.LocalTransparencyModifier ~= nil then h.LocalTransparencyModifier = 0 else h.Transparency = 0 end
                end)
            end
        end
    end
    Notify("Tudo desligado")
end)

-- Final notification
Notify("OiHub carregado. Insira a key para abrir o Hub.", 4)

-- End of script

Features & Information

Script para todos os jogos

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts