Trash Script i made
Key RequiredUniversal

Trash Script i made

Universal Scriptyusaydravenyusaydraven 646 views 10 executesUpdated Oct 4, 2025
Unrated
00
Lua Script•765 lines (29205 chars)
-- UltimateAdminPanel_WithLockOn.lua
-- LocalScript -> StarterGui
-- Full Admin Panel (black + neon green) + Lock-On aimbot (players + NPCs, smooth, auto-switch)

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInput = game:GetService("UserInputService")
local Workspace = game:GetService("Workspace")
local StarterGui = game:GetService("StarterGui")

local player = Players.LocalPlayer
if not player then return end
local playerGui = player:WaitForChild("PlayerGui")

-- Prevent duplicate GUI
if playerGui:FindFirstChild("UltimateAdminPanel") then
    return
end

-- ---------- Config for Lock-On ----------
local LOCK_CONFIG = {
    RANGE = 250,         -- detection range in studs
    LERP = 0.36,         -- camera lerp smoothing (0..1)
    REQUIRE_ONSCREEN = false, -- require head to be on screen
    IGNORE_WALLS = false -- if false, raycast to prefer visible targets
}

-- ---------- UI ----------
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "UltimateAdminPanel"
screenGui.ResetOnSpawn = false
screenGui.Parent = playerGui

local main = Instance.new("Frame")
main.Name = "Main"
main.Size = UDim2.new(0, 520, 0, 720)
main.Position = UDim2.new(0.5, -260, 0.08, 0)
main.BackgroundColor3 = Color3.fromRGB(10,10,10)
main.BorderSizePixel = 0
main.ClipsDescendants = true
main.Active = false
main.Selectable = false
main.Parent = screenGui

local header = Instance.new("Frame", main)
header.Size = UDim2.new(1,0,0,52)
header.BackgroundTransparency = 1
header.Active = true

local title = Instance.new("TextLabel", header)
title.Size = UDim2.new(1,-140,1,0)
title.Position = UDim2.new(0,12,0,0)
title.BackgroundTransparency = 1
title.Text = "Admin Panel"
title.Font = Enum.Font.Arcade
title.TextSize = 22
title.TextColor3 = Color3.fromRGB(0,255,0)
title.TextXAlignment = Enum.TextXAlignment.Left

local closeBtn = Instance.new("TextButton", header)
closeBtn.Size = UDim2.new(0,100,0,36)
closeBtn.Position = UDim2.new(1,-116,0,8)
closeBtn.Text = "Close"
closeBtn.Font = Enum.Font.Arcade
closeBtn.TextSize = 16
closeBtn.BackgroundColor3 = Color3.fromRGB(35,0,0)
closeBtn.TextColor3 = Color3.fromRGB(0,255,0)
closeBtn.AutoButtonColor = true
closeBtn.Parent = header
closeBtn.MouseButton1Click:Connect(function() main.Visible = false end)

-- header drag
do
    local dragging, dragInput, dragStart, startPos
    header.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 then
            dragging = true
            dragStart = input.Position
            startPos = main.Position
            input.Changed:Connect(function()
                if input.UserInputState == Enum.UserInputState.End then dragging = false end
            end)
        end
    end)
    header.InputChanged:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseMovement then dragInput = input end
    end)
    UserInput.InputChanged:Connect(function(input)
        if input == dragInput and dragging and dragStart and startPos then
            local delta = input.Position - dragStart
            main.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X,
                                      startPos.Y.Scale, startPos.Y.Offset + delta.Y)
        end
    end)
end

-- scroll area (active to allow internal buttons clickable)
local scroll = Instance.new("ScrollingFrame", main)
scroll.Size = UDim2.new(1, -16, 1, -72)
scroll.Position = UDim2.new(0, 8, 0, 60)
scroll.BackgroundTransparency = 1
scroll.ScrollBarThickness = 6
scroll.AutomaticCanvasSize = Enum.AutomaticSize.Y
scroll.Active = true
scroll.Selectable = false

local listLayout = Instance.new("UIListLayout", scroll)
listLayout.SortOrder = Enum.SortOrder.LayoutOrder
listLayout.Padding = UDim.new(0,6)

local function notify(t, txt, dur)
    pcall(function() StarterGui:SetCore("SendNotification", {Title = t, Text = txt, Duration = dur or 3}) end)
end

local function makeButton(text, callback)
    local btn = Instance.new("TextButton")
    btn.Parent = scroll
    btn.Size = UDim2.new(1, -12, 0, 44)
    btn.BackgroundColor3 = Color3.fromRGB(6,6,6)
    btn.BorderSizePixel = 0
    btn.Font = Enum.Font.Arcade
    btn.TextSize = 15
    btn.Text = text
    btn.TextColor3 = Color3.fromRGB(0,255,0)
    local corner = Instance.new("UICorner", btn)
    corner.CornerRadius = UDim.new(0,8)
    btn.MouseButton1Click:Connect(function()
        local ok, err = pcall(callback)
        if not ok then warn("Button callback error:", err) end
    end)
    return btn
end

-- ---------- small helpers ----------
local function waitForChar()
    if player.Character and player.Character.Parent then return player.Character end
    return player.CharacterAdded:Wait()
end
local function getHumanoid(p)
    p = p or player
    local ch = p.Character
    if not ch then return nil end
    return ch:FindFirstChildOfClass("Humanoid")
end
local function getHRP(p)
    p = p or player
    local ch = p.Character
    if not ch then return nil end
    return ch:FindFirstChild("HumanoidRootPart") or ch:FindFirstChildWhichIsA("BasePart")
end

-- ---------- state ----------
local state = {
    fly={on=false, bv=nil, conns={}},
    esp={on=false, list={}},
    lockOn={on=false, target=nil, range=LOCK_CONFIG.RANGE},
    spin=false,
    walkSpeed=16,
    walkIncr=10,
    jumpBoost=false,
    noclip=false,
    invisible=false,
    forceField=false,
    godmode={on=false, conn=nil}
}

-- ---------- ESP (players + NPCs) ----------
local function createESPForCharacter(model, displayName)
    if not model or state.esp.list[model] then return end
    local hrp = model:FindFirstChild("HumanoidRootPart") or model:FindFirstChildWhichIsA("BasePart")
    if not hrp then return end
    local b = Instance.new("BillboardGui")
    b.Name = "ESP_"..tostring(displayName)
    b.Adornee = hrp
    b.Size = UDim2.new(0, 140, 0, 48)
    b.AlwaysOnTop = true
    b.Parent = playerGui

    local lbl = Instance.new("TextLabel", b)
    lbl.Size = UDim2.fromScale(1,1)
    lbl.BackgroundTransparency = 0.35
    lbl.BackgroundColor3 = Color3.fromRGB(0,0,0)
    lbl.TextColor3 = Color3.fromRGB(0,255,0)
    lbl.Font = Enum.Font.Arcade
    lbl.TextSize = 14
    lbl.Text = displayName

    local conn
    conn = RunService.Heartbeat:Connect(function()
        if not model.Parent then
            if conn then conn:Disconnect() end
            if b and b.Parent then b:Destroy() end
            state.esp.list[model] = nil
            return
        end
        local myHRP = getHRP(player)
        if myHRP and hrp then
            local dist = math.floor((hrp.Position - myHRP.Position).Magnitude)
            lbl.Text = displayName .. "\n" .. tostring(dist) .. " studs"
        end
    end)

    state.esp.list[model] = {gui=b, conn=conn}
end

local function removeESPForCharacter(model)
    local entry = state.esp.list[model]
    if entry then
        if entry.conn then pcall(function() entry.conn:Disconnect() end) end
        if entry.gui and entry.gui.Parent then pcall(function() entry.gui:Destroy() end) end
        state.esp.list[model] = nil
    end
end

local function scanForNPCsAndCreate()
    for _, obj in ipairs(Workspace:GetDescendants()) do
        if obj:IsA("Model") and obj:FindFirstChildOfClass("Humanoid") and obj:FindFirstChild("Head") then
            if not Players:GetPlayerFromCharacter(obj) then
                createESPForCharacter(obj, obj.Name)
            end
        end
    end
end

-- ESP toggle
makeButton("ESP (Players + NPCs) Toggle", function()
    state.esp.on = not state.esp.on
    if state.esp.on then
        for _, pl in ipairs(Players:GetPlayers()) do
            if pl ~= player and pl.Character then createESPForCharacter(pl.Character, pl.Name) end
        end
        scanForNPCsAndCreate()
        notify("ESP", "ON")
    else
        for model, entry in pairs(state.esp.list) do
            pcall(function()
                if entry.conn then entry.conn:Disconnect() end
                if entry.gui and entry.gui.Parent then entry.gui:Destroy() end
            end)
        end
        state.esp.list = {}
        notify("ESP", "OFF")
    end
end)

Players.PlayerAdded:Connect(function(pl)
    pl.CharacterAdded:Connect(function(ch)
        if state.esp.on then createESPForCharacter(ch, pl.Name) end
    end)
end)
Players.PlayerRemoving:Connect(function(pl)
    if pl.Character then removeESPForCharacter(pl.Character) end
end)
Workspace.DescendantAdded:Connect(function(obj)
    if state.esp.on and obj:IsA("Model") and obj:FindFirstChildOfClass("Humanoid") and obj:FindFirstChild("Head") and not Players:GetPlayerFromCharacter(obj) then
        createESPForCharacter(obj, obj.Name)
    end
end)
Workspace.DescendantRemoving:Connect(function(obj)
    if state.esp.list[obj] then removeESPForCharacter(obj) end
end)

-- ---------- Lock-On (players + NPCs) ----------
local function isModelValidForLock(model)
    if not model or not model.Parent then return false end
    local head = model:FindFirstChild("Head")
    local humanoid = model:FindFirstChildOfClass("Humanoid")
    if not head or not humanoid then return false end
    if humanoid.Health and humanoid.Health <= 0 then return false end
    if Players:GetPlayerFromCharacter(model) == player then return false end

    -- distance
    local myHead = player.Character and player.Character:FindFirstChild("Head")
    if not myHead then return false end
    local d = (head.Position - myHead.Position).Magnitude
    if d > LOCK_CONFIG.RANGE then return false end

    -- optional on-screen check
    if LOCK_CONFIG.REQUIRE_ONSCREEN then
        local _, onScreen = Workspace.CurrentCamera:WorldToViewportPoint(head.Position)
        if not onScreen then return false end
    end

    -- optional visibility (raycast)
    if not LOCK_CONFIG.IGNORE_WALLS then
        local origin = Workspace.CurrentCamera.CFrame.Position
        local direction = (head.Position - origin)
        local rayParams = RaycastParams.new()
        rayParams.FilterDescendantsInstances = {player.Character}
        rayParams.FilterType = Enum.RaycastFilterType.Blacklist
        rayParams.IgnoreWater = true
        local result = Workspace:Raycast(origin, direction.Unit * math.min(direction.Magnitude, LOCK_CONFIG.RANGE), rayParams)
        if result and result.Instance then
            local partAncestor = result.Instance:FindFirstAncestorOfClass("Model")
            if partAncestor ~= model then
                -- blocked
                return false
            end
        end
    end

    return true
end

local function findClosestValidTarget()
    local myHead = player.Character and player.Character:FindFirstChild("Head")
    if not myHead then return nil end
    local bestDist = LOCK_CONFIG.RANGE
    local bestModel = nil

    -- players
    for _, pl in ipairs(Players:GetPlayers()) do
        if pl ~= player and pl.Character and pl.Character:FindFirstChild("Head") then
            local model = pl.Character
            if isModelValidForLock(model) then
                local d = (model.Head.Position - myHead.Position).Magnitude
                if d < bestDist then bestDist = d; bestModel = model end
            end
        end
    end

    -- NPCs (models in workspace with Humanoid + Head)
    for _, obj in ipairs(Workspace:GetDescendants()) do
        if obj:IsA("Model") and obj:FindFirstChildOfClass("Humanoid") and obj:FindFirstChild("Head") then
            if not Players:GetPlayerFromCharacter(obj) then
                if isModelValidForLock(obj) then
                    local d = (obj.Head.Position - myHead.Position).Magnitude
                    if d < bestDist then bestDist = d; bestModel = obj end
                end
            end
        end
    end

    return bestModel
end

makeButton("Lock-On Toggle", function()
    state.lockOn.on = not state.lockOn.on
    if not state.lockOn.on then state.lockOn.target = nil end
    notify("Lock-On", state.lockOn.on and "ON" or "OFF")
end)

-- smooth camera lerp to current lock target; auto-switch if invalid
RunService.RenderStepped:Connect(function()
    if not state.lockOn.on then return end
    -- validate current target
    local targ = state.lockOn.target
    if not targ or not targ.Parent or not targ:FindFirstChild("Head") or not isModelValidForLock(targ) then
        state.lockOn.target = findClosestValidTarget()
        targ = state.lockOn.target
        if not targ then return end
    end

    local head = targ:FindFirstChild("Head")
    if not head then return end

    -- ensure still in range
    local myHead = player.Character and player.Character:FindFirstChild("Head")
    if not myHead then return end
    local dist = (head.Position - myHead.Position).Magnitude
    if dist > LOCK_CONFIG.RANGE then
        state.lockOn.target = nil
        return
    end

    local cam = Workspace.CurrentCamera
    if not cam then return end
    local camPos = cam.CFrame.Position
    local goal = CFrame.new(camPos, head.Position)
    cam.CFrame = cam.CFrame:Lerp(goal, LOCK_CONFIG.LERP)
end)

-- ---------- Fly (improved) ----------
local flyInputs = {forward=0,right=0,up=0}
local function startFly()
    if state.fly.bv and state.fly.bv.Parent then return end
    local ch = waitForChar()
    local hrp = ch:FindFirstChild("HumanoidRootPart") or ch:FindFirstChildWhichIsA("BasePart")
    if not hrp then return end

    state.fly.bv = Instance.new("BodyVelocity")
    state.fly.bv.Name = "__UltimateFlyBV"
    state.fly.bv.MaxForce = Vector3.new(1e5,1e5,1e5)
    state.fly.bv.P = 10000
    state.fly.bv.Velocity = Vector3.new(0,0,0)
    state.fly.bv.Parent = hrp

    local hum = ch:FindFirstChildOfClass("Humanoid")
    if hum then hum.PlatformStand = true end

    table.insert(state.fly.conns, UserInput.InputBegan:Connect(function(input, processed)
        if processed then return end
        local k = input.KeyCode
        if k==Enum.KeyCode.W then flyInputs.forward = 1 end
        if k==Enum.KeyCode.S then flyInputs.forward = -1 end
        if k==Enum.KeyCode.D then flyInputs.right = 1 end
        if k==Enum.KeyCode.A then flyInputs.right = -1 end
        if k==Enum.KeyCode.Space then flyInputs.up = 1 end
        if k==Enum.KeyCode.LeftShift or k==Enum.KeyCode.LeftControl then flyInputs.up = -1 end
    end))
    table.insert(state.fly.conns, UserInput.InputEnded:Connect(function(input, processed)
        if processed then return end
        local k = input.KeyCode
        if k==Enum.KeyCode.W or k==Enum.KeyCode.S then flyInputs.forward = 0 end
        if k==Enum.KeyCode.A or k==Enum.KeyCode.D then flyInputs.right = 0 end
        if k==Enum.KeyCode.Space or k==Enum.KeyCode.LeftShift or k==Enum.KeyCode.LeftControl then flyInputs.up = 0 end
    end))
    table.insert(state.fly.conns, RunService.Heartbeat:Connect(function()
        if not state.fly.on then return end
        local cam = Workspace.CurrentCamera
        if not cam or not state.fly.bv then return end
        local move = Vector3.new()
        if flyInputs.forward ~= 0 then move = move + cam.CFrame.LookVector * flyInputs.forward end
        if flyInputs.right ~= 0 then move = move + cam.CFrame.RightVector * flyInputs.right end
        if flyInputs.up ~= 0 then move = move + Vector3.new(0, flyInputs.up, 0) end
        if move.Magnitude > 0 then
            state.fly.bv.Velocity = move.Unit * 140
        else
            state.fly.bv.Velocity = Vector3.new(0,0,0)
        end
    end))
end

local function stopFly()
    state.fly.on = false
    if state.fly.bv and state.fly.bv.Parent then pcall(function() state.fly.bv:Destroy() end) end
    state.fly.bv = nil
    for _,c in ipairs(state.fly.conns) do pcall(function() c:Disconnect() end) end
    state.fly.conns = {}
    local ch = player.Character
    local hum = ch and ch:FindFirstChildOfClass("Humanoid")
    if hum then hum.PlatformStand = false end
end

makeButton("Fly Toggle", function()
    state.fly.on = not state.fly.on
    if state.fly.on then startFly(); notify("Fly", "ON") else stopFly(); notify("Fly", "OFF") end
end)

-- ---------- Spin ----------
makeButton("Spin Toggle", function()
    state.spin = not state.spin
    notify("Spin", state.spin and "ON" or "OFF")
end)
RunService.RenderStepped:Connect(function()
    if state.spin and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
        local hrp = player.Character.HumanoidRootPart
        hrp.CFrame = hrp.CFrame * CFrame.Angles(0, math.rad(18), 0)
    end
end)

-- ---------- WalkFast incremental ----------
makeButton("WalkFast (click to increase)", function()
    local hum = getHumanoid()
    if not hum then notify("WalkFast", "No humanoid") return end
    state.walkSpeed = (state.walkSpeed or 16) + state.walkIncr
    hum.WalkSpeed = state.walkSpeed
    notify("WalkSpeed", "Now " .. tostring(hum.WalkSpeed))
end)
makeButton("Reset WalkSpeed", function()
    local hum = getHumanoid()
    if not hum then notify("WalkSpeed", "No humanoid") return end
    state.walkSpeed = 16
    hum.WalkSpeed = 16
    notify("WalkSpeed", "Reset to 16")
end)

-- ---------- JumpBoost ----------
makeButton("JumpBoost Toggle", function()
    local hum = getHumanoid()
    if not hum then notify("Jump", "No humanoid") return end
    state.jumpBoost = not state.jumpBoost
    hum.JumpPower = state.jumpBoost and 150 or 50
    notify("JumpBoost", state.jumpBoost and "ON" or "OFF")
end)

-- ---------- Noclip ----------
makeButton("Noclip Toggle", function()
    state.noclip = not state.noclip
    notify("Noclip", state.noclip and "ON" or "OFF")
end)
RunService.Stepped:Connect(function()
    if state.noclip and player.Character then
        for _, part in ipairs(player.Character:GetDescendants()) do
            if part:IsA("BasePart") then part.CanCollide = false end
        end
    end
end)

-- ---------- Invisibility ----------
makeButton("Invisibility Toggle (local)", function()
    state.invisible = not state.invisible
    if player.Character then
        for _, part in ipairs(player.Character:GetDescendants()) do
            if part:IsA("BasePart") and part.Name ~= "HumanoidRootPart" then
                pcall(function() part.Transparency = state.invisible and 1 or 0 end)
            end
            if part:IsA("Decal") then pcall(function() part.Transparency = state.invisible and 1 or 0 end) end
        end
    end
    notify("Invisibility", state.invisible and "ON" or "OFF")
end)

-- ---------- ForceField (visual) ----------
makeButton("ForceField Toggle", function()
    state.forceField = not state.forceField
    if state.forceField then
        if player.Character and not player.Character:FindFirstChildOfClass("ForceField") then
            local ff = Instance.new("ForceField", player.Character)
            ff.Name = "__AdminForceField"
        end
        notify("ForceField", "ON")
    else
        if player.Character then
            for _, v in ipairs(player.Character:GetChildren()) do
                if v:IsA("ForceField") and v.Name == "__AdminForceField" then pcall(function() v:Destroy() end) end
            end
        end
        notify("ForceField", "OFF")
    end
end)

-- ---------- Teleport nearest (instant) ----------
makeButton("Teleport to Nearest", function()
    local hrp = getHRP(player)
    if not hrp then notify("Teleport","No HRP"); return end
    local best = math.huge; local bestModel = nil
    for _, pl in ipairs(Players:GetPlayers()) do
        if pl ~= player and pl.Character and pl.Character:FindFirstChild("HumanoidRootPart") then
            local d = (pl.Character.HumanoidRootPart.Position - hrp.Position).Magnitude
            if d < best then best = d; bestModel = pl.Character end
        end
    end
    for _, obj in ipairs(Workspace:GetDescendants()) do
        if obj:IsA("Model") and obj:FindFirstChildOfClass("Humanoid") and obj:FindFirstChild("HumanoidRootPart") then
            if not Players:GetPlayerFromCharacter(obj) then
                local d = (obj.HumanoidRootPart.Position - hrp.Position).Magnitude
                if d < best then best = d; bestModel = obj end
            end
        end
    end
    if bestModel and bestModel:FindFirstChild("HumanoidRootPart") then
        hrp.CFrame = bestModel.HumanoidRootPart.CFrame + Vector3.new(0,3,0)
        notify("Teleport", "To nearest target")
    else
        notify("Teleport", "No target found")
    end
end)

-- ---------- Teleport by name prompt ----------
makeButton("Teleport To (by name)", function()
    local tb = Instance.new("TextBox", screenGui)
    tb.Size = UDim2.new(0, 360, 0, 36)
    tb.Position = UDim2.new(0.5, -180, 0.5, -18)
    tb.PlaceholderText = "Enter exact player name and press Enter"
    tb.ClearTextOnFocus = false
    tb:CaptureFocus()
    tb.FocusLost:Connect(function(enter)
        if enter and tb.Text ~= "" then
            local target = Players:FindFirstChild(tb.Text)
            local hrp = getHRP(player)
            if target and target.Character and target.Character:FindFirstChild("HumanoidRootPart") and hrp then
                hrp.CFrame = target.Character.HumanoidRootPart.CFrame + Vector3.new(0,3,0)
                notify("Teleport", "To "..tb.Text)
            else
                notify("Teleport","Player not found or no character")
            end
        end
        pcall(function() tb:Destroy() end)
    end)
end)

-- ---------- Bring / Fling / Explosion / Freeze / Unfreeze / Kill ----------
makeButton("Bring All", function()
    local myHRP = getHRP(player)
    if not myHRP then notify("Bring","No HRP"); return end
    for _, pl in ipairs(Players:GetPlayers()) do
        if pl~=player and pl.Character and pl.Character:FindFirstChild("HumanoidRootPart") then
            pcall(function()
                pl.Character.HumanoidRootPart.CFrame = myHRP.CFrame * CFrame.new(math.random(-6,6), 0, math.random(-6,6))
            end)
        end
    end
    notify("Bring","Attempted (client-side)")
end)

makeButton("Fling All", function()
    for _, pl in ipairs(Players:GetPlayers()) do
        if pl.Character and pl.Character:FindFirstChild("HumanoidRootPart") then
            pcall(function()
                pl.Character.HumanoidRootPart.Velocity = Vector3.new(math.random(-1800,1800), 1600 + math.random(0,400), math.random(-1800,1800))
            end)
        end
    end
    notify("Fling", "Applied (client)")
end)

makeButton("Explosion All", function()
    for _, pl in ipairs(Players:GetPlayers()) do
        if pl.Character and pl.Character:FindFirstChild("HumanoidRootPart") then
            local e = Instance.new("Explosion")
            e.Position = pl.Character.HumanoidRootPart.Position
            e.BlastRadius = 10
            e.DestroyJointRadiusPercent = 0
            e.Parent = Workspace
        end
    end
    notify("Explosion", "Created (client)")
end)

makeButton("Freeze All (anchor)", function()
    for _, pl in ipairs(Players:GetPlayers()) do
        if pl.Character then
            for _, part in ipairs(pl.Character:GetDescendants()) do
                if part:IsA("BasePart") then pcall(function() part.Anchored = true end) end
            end
        end
    end
    notify("FreezeAll", "Anchored (client)")
end)
makeButton("Unfreeze All", function()
    for _, pl in ipairs(Players:GetPlayers()) do
        if pl.Character then
            for _, part in ipairs(pl.Character:GetDescendants()) do
                if part:IsA("BasePart") then pcall(function() part.Anchored = false end) end
            end
        end
    end
    notify("Unfreeze", "Unanchored")
end)

makeButton("Kill Nearest", function()
    local hrp = getHRP(player)
    if not hrp then notify("Kill","No HRP") return end
    local best = math.huge; local target = nil
    for _, pl in ipairs(Players:GetPlayers()) do
        if pl~=player and pl.Character and pl.Character:FindFirstChildOfClass("Humanoid") and pl.Character:FindFirstChild("HumanoidRootPart") then
            local d = (pl.Character.HumanoidRootPart.Position - hrp.Position).Magnitude
            if d < best then best = d; target = pl.Character end
        end
    end
    if target and target:FindFirstChildOfClass("Humanoid") then
        pcall(function() target:FindFirstChildOfClass("Humanoid").Health = 0 end)
        notify("Kill", "Attempted nearest kill")
    else
        notify("Kill", "No target")
    end
end)

-- ---------- Godmode (local) ----------
makeButton("Godmode Toggle (local)", function()
    state.godmode.on = not state.godmode.on
    if state.godmode.on then
        state.godmode.conn = RunService.Heartbeat:Connect(function()
            local hum = getHumanoid()
            if hum then
                if hum.Health <= 1 then hum.Health = hum.MaxHealth end
                hum.Health = math.min(hum.MaxHealth, hum.Health + 0.75)
            end
        end)
    else
        if state.godmode.conn then pcall(function() state.godmode.conn:Disconnect() end) end
        state.godmode.conn = nil
    end
    notify("Godmode", state.godmode.on and "ON" or "OFF")
end)

-- ---------- Give Tool / Coins / Announce / Respawn / Clear ----------
makeButton("Give Local Sword", function()
    local tool = Instance.new("Tool")
    tool.Name = "LocalSword"
    tool.CanBeDropped = false
    local handle = Instance.new("Part")
    handle.Name = "Handle"; handle.Size = Vector3.new(1,4,1)
    handle.Color = Color3.fromRGB(0,255,0); handle.Parent = tool
    tool.Parent = player.Backpack
    pcall(function() local hum = getHumanoid(); if hum then hum:EquipTool(tool) end end)
    notify("Tool","LocalSword added")
end)

makeButton("Give Coins (local)", function()
    if not player:FindFirstChild("leaderstats") then
        local folder = Instance.new("Folder", player); folder.Name = "leaderstats"
        local coins = Instance.new("IntValue", folder); coins.Name = "Coins"; coins.Value = 99999
    else
        local coins = player.leaderstats:FindFirstChild("Coins")
        if coins and coins:IsA("IntValue") then coins.Value = coins.Value + 99999 end
    end
    notify("Coins","Added (local)")
end)

makeButton("Announce (system)", function()
    pcall(function()
        StarterGui:SetCore("ChatMakeSystemMessage", {
            Text = "[ADMIN] This server has been upgraded.";
            Color = Color3.fromRGB(0,255,0);
            Font = Enum.Font.GothamBold;
        })
    end)
end)

makeButton("Respawn Self", function() pcall(function() player:LoadCharacter() end) end)

makeButton("Clear All Effects", function()
    if state.fly.on then pcall(stopFly) end
    state.spin = false
    state.lockOn.on = false; state.lockOn.target = nil
    state.noclip = false
    state.invisible = false
    state.jumpBoost = false
    state.forceField = false
    for k, v in pairs(state.esp.list) do pcall(function() if v.conn then v.conn:Disconnect() end; if v.gui and v.gui.Parent then v.gui:Destroy() end end) end
    state.esp.list = {}
    for k, v in pairs(state.multiESP.list) do pcall(function() if v.gui and v.gui.Parent then v.gui:Destroy() end end) end
    state.multiESP.list = {}
    if player.Character then
        for _, part in ipairs(player.Character:GetDescendants()) do
            if part:IsA("BasePart") then pcall(function() part.CanCollide = true; part.Transparency = 0; part.Anchored = false end) end
            if part:IsA("Decal") then pcall(function() part.Transparency = 0 end) end
            if part:IsA("ForceField") and part.Name == "__AdminForceField" then pcall(function() part:Destroy() end) end
        end
        local hum = getHumanoid()
        if hum then hum.WalkSpeed = 16; hum.JumpPower = 50; hum.PlatformStand = false end
    end
    if state.godmode.conn then pcall(function() state.godmode.conn:Disconnect() end) end
    state.godmode.conn = nil; state.godmode.on = false
    notify("Clear", "All effects cleared")
end)

-- ---------- event handling ----------
Players.PlayerAdded:Connect(function(pl)
    pl.CharacterAdded:Connect(function(ch)
        if state.esp.on then createESPForCharacter(ch, pl.Name) end
    end)
end)
Players.PlayerRemoving:Connect(function(pl)
    if pl.Character then removeESPForCharacter(pl.Character) end
end)
Workspace.DescendantAdded:Connect(function(obj)
    if state.esp.on and obj:IsA("Model") and obj:FindFirstChildOfClass("Humanoid") and obj:FindFirstChild("Head") and not Players:GetPlayerFromCharacter(obj) then
        createESPForCharacter(obj, obj.Name)
    end
end)
Workspace.DescendantRemoving:Connect(function(obj)
    if state.esp.list[obj] then removeESPForCharacter(obj) end
end)

-- toggle GUI by RightControl
UserInput.InputBegan:Connect(function(input, processed)
    if processed then return end
    if input.KeyCode == Enum.KeyCode.RightControl then
        main.Visible = not main.Visible
    end
end)

-- cleanup on character remove
player.CharacterRemoving:Connect(function()
    if state.fly.on then pcall(stopFly) end
    if state.godmode.conn then pcall(function() state.godmode.conn:Disconnect() end) end
    for k,v in pairs(state.esp.list) do pcall(function() if v.conn then v.conn:Disconnect() end; if v.gui and v.gui.Parent then v.gui:Destroy() end end) end
    state.esp.list = {}
    state.multiESP.list = {}
end)

notify("Admin Panel", "Loaded. RightCtrl toggles GUI", 4)

Features & Information

I dont know

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts