A untitled admin script
Key RequiredUniversal

A untitled admin script

Universal Scriptwilliamarlazarowilliamarlazaro 7.6K views 32 executesUpdated May 23, 2025
Unrated
00
Lua Script•200 lines (6567 chars)
-- Create ScreenGui
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "CommandGUI"
screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")

-- Create a Frame to hold the GUI elements
local frame = Instance.new("Frame")
frame.Size = UDim2.new(0, 300, 0, 100)
frame.Position = UDim2.new(0.5, -150, 0.5, -50)
frame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
frame.Parent = screenGui

-- Create a TextBox for input
local commandBox = Instance.new("TextBox")
commandBox.Size = UDim2.new(0, 200, 0, 30)
commandBox.Position = UDim2.new(0, 10, 0, 10)
commandBox.PlaceholderText = "Enter command..."
commandBox.Text = ""
commandBox.Parent = frame

-- Create a Button to execute command
local executeButton = Instance.new("TextButton")
executeButton.Size = UDim2.new(0, 80, 0, 30)
executeButton.Position = UDim2.new(0, 220, 0, 10)
executeButton.Text = "Execute"
executeButton.Parent = frame

-- Variables for flying
local flying = false
local flySpeed = 50
local flyConnection

local function startFly()
    if flying then return end
    flying = true
    local player = game.Players.LocalPlayer
    local character = player.Character
    if not character then return end
    local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
    if not humanoidRootPart then return end

    -- Create BodyVelocity for flying
    local bodyVelocity = Instance.new("BodyVelocity")
    bodyVelocity.Name = "FlyVelocity"
    bodyVelocity.MaxForce = Vector3.new(1e5, 1e5, 1e5)
    bodyVelocity.Velocity = Vector3.new(0,0,0)
    bodyVelocity.Parent = humanoidRootPart

    -- Update velocity based on camera direction
    flyConnection = game:GetService("RunService").Heartbeat:Connect(function()
        local camera = workspace.CurrentCamera
        local direction = camera.CFrame.LookVector
        bodyVelocity.Velocity = direction * flySpeed
    end)
end

local function stopFly()
    if not flying then return end
    flying = false
    local player = game.Players.LocalPlayer
    local character = player.Character
    if not character then return end
    local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
    if not humanoidRootPart then return end
    local bodyVelocity = humanoidRootPart:FindFirstChild("FlyVelocity")
    if bodyVelocity then
        bodyVelocity:Destroy()
    end
    if flyConnection then
        flyConnection:Disconnect()
        flyConnection = nil
    end
end

-- Function to reset position
local function resetPosition()
    local player = game.Players.LocalPlayer
    local character = player.Character
    if not character then return end
    local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
    if not humanoidRootPart then return end
    humanoidRootPart.CFrame = CFrame.new(0, 5, 0)
end

-- Function to kill player
local function killPlayer()
    local player = game.Players.LocalPlayer
    local character = player.Character
    if not character then return end
    local humanoid = character:FindFirstChildOfClass("Humanoid")
    if humanoid then
        humanoid.Health = 0
    end
end

-- Fling: apply a force to the character
local function fling()
    local player = game.Players.LocalPlayer
    local character = player.Character
    if not character then return end
    local hrp = character:FindFirstChild("HumanoidRootPart")
    local humanoid = character:FindFirstChildOfClass("Humanoid")
    if hrp and humanoid then
        -- Apply a force in a direction
        local force = Instance.new("BodyVelocity")
        force.Velocity = Vector3.new(math.random(-100,100), math.random(50,150), math.random(-100,100))
        force.MaxForce = Vector3.new(1e5, 1e5, 1e5)
        force.Parent = hrp
        -- Remove after a second
        game:GetService("Debris"):AddItem(force, 1)
    end
end

-- Function to toggle noclip
local noclip = false
local noclipConnection
local function toggleNoclip()
    noclip = not noclip
    local character = game.Players.LocalPlayer.Character
    if not character then return end
    if noclip then
        -- Disable collisions
        for _, part in pairs(character:GetChildren()) do
            if part:IsA("BasePart") then
                part.CanCollide = false
            end
        end
        -- Keep disabling in case new parts are added
        noclipConnection = game:GetService("RunService").Stepped:Connect(function()
            for _, part in pairs(character:GetChildren()) do
                if part:IsA("BasePart") then
                    part.CanCollide = false
                end
            end
        end)
    else
        -- Enable collisions
        if noclipConnection then
            noclipConnection:Disconnect()
            noclipConnection = nil
        end
        for _, part in pairs(character:GetChildren()) do
            if part:IsA("BasePart") then
                part.CanCollide = true
            end
        end
    end
end

-- Function for third person
local function setThirdPerson()
    workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
end

-- Function for first person
local function setFirstPerson()
    workspace.CurrentCamera.CameraSubject = nil
    workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
    workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
    workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
end

-- Command execution
executeButton.MouseButton1Click:Connect(function()
    local command = commandBox.Text:lower()

    if command == "fly" then
        startFly()
    elseif command == "unfly" then
        stopFly()
    elseif command == "reset" then
        resetPosition()
    elseif command == "kill" then
        killPlayer()
    elseif command == "fling" then
        fling()
    elseif command == "noclip" then
        toggleNoclip()
    elseif command == "unnoclip" then
        toggleNoclip()
    elseif command == "thirdperson" then
        setThirdPerson()
    elseif command == "firstperson" then
        setFirstPerson()
    elseif command == "jump" then
        local humanoid = game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
        if humanoid then
            humanoid.Jump = true
        end
    else
        print("Unknown command: " .. command)
    end
end)

-- Optional: You can also add pressing Enter to trigger command
commandBox.FocusLost:Connect(function(enterPressed)
    if enterPressed then
        executeButton:Fire()
    end
end)

Features & Information

A admin commands of a bar
#admin

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts