Gun game script universal.v1.0
Key RequiredUniversal

Gun game script universal.v1.0

Universal ScriptCara_azul666Cara_azul666 7.8K views 9.4K executesUpdated Apr 22, 2025
5.0/ 5(2 votes)
20100% Positive
Lua Script•271 lines (9653 chars)
-- GUI principal
local ScreenGui = Instance.new("ScreenGui", game.CoreGui)
ScreenGui.Name = "Gun"

local Frame = Instance.new("Frame", ScreenGui)
Frame.Size = UDim2.new(0, 220, 0, 200)
Frame.Position = UDim2.new(0, 50, 0, 50)
Frame.BackgroundColor3 = Color3.fromRGB(0, 0, 170)
Frame.BorderSizePixel = 0
Frame.Active = true
Frame.Draggable = true

-- Título
local Title = Instance.new("TextLabel", Frame)
Title.Size = UDim2.new(1, 0, 0, 30)
Title.Position = UDim2.new(0, 0, 0, 0)
Title.BackgroundTransparency = 1
Title.Text = "Gun"
Title.TextColor3 = Color3.fromRGB(255, 0, 0)
Title.Font = Enum.Font.SourceSansBold
Title.TextSize = 22

-- Botão Gun GUI
local GunGuiButton = Instance.new("TextButton")
GunGuiButton.Size = UDim2.new(0, 120, 0, 40)
GunGuiButton.Position = UDim2.new(0, 50, 0, 100)
GunGuiButton.Text = "Gun GUI"
GunGuiButton.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
GunGuiButton.TextColor3 = Color3.new(1, 1, 1)
GunGuiButton.Font = Enum.Font.SourceSansBold
GunGuiButton.TextSize = 18
GunGuiButton.BorderSizePixel = 0
GunGuiButton.Parent = game.CoreGui

-- Variáveis para guardar o estado dos botões
local savedPosition
local savedAimbotState = false
local savedWallCheckState = false
local savedESPState = false
local espConnections = {}

-- Botão de fechar
local CloseBtn = Instance.new("TextButton", Frame)
CloseBtn.Size = UDim2.new(0, 25, 0, 25)
CloseBtn.Position = UDim2.new(1, -30, 0, 5)
CloseBtn.Text = "X"
CloseBtn.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
CloseBtn.TextColor3 = Color3.new(1, 1, 1)
CloseBtn.Font = Enum.Font.SourceSansBold
CloseBtn.TextSize = 16
CloseBtn.MouseButton1Click:Connect(function()
    savedPosition = Frame.Position
    savedAimbotState = aimbotActive
    savedWallCheckState = wallCheck
    savedESPState = espActive
    ScreenGui:Destroy()
    GunGuiButton.Visible = true
end)

-- Reabrir GUI ao clicar no botão Gun GUI
GunGuiButton.MouseButton1Click:Connect(function()
    criarGUI()
    GunGuiButton.Visible = false
end)

-- Função para criar a GUI
local function criarGUI()
    ScreenGui = Instance.new("ScreenGui", game.CoreGui)
    ScreenGui.Name = "Gun"

    Frame = Instance.new("Frame", ScreenGui)
    Frame.Size = UDim2.new(0, 220, 0, 200)
    Frame.Position = savedPosition or UDim2.new(0, 50, 0, 50)
    Frame.BackgroundColor3 = Color3.fromRGB(0, 0, 170)
    Frame.BorderSizePixel = 0
    Frame.Active = true
    Frame.Draggable = true

    Title = Instance.new("TextLabel", Frame)
    Title.Size = UDim2.new(1, 0, 0, 30)
    Title.Position = UDim2.new(0, 0, 0, 0)
    Title.BackgroundTransparency = 1
    Title.Text = "Gun"
    Title.TextColor3 = Color3.fromRGB(255, 0, 0)
    Title.Font = Enum.Font.SourceSansBold
    Title.TextSize = 22

    CloseBtn = Instance.new("TextButton", Frame)
    CloseBtn.Size = UDim2.new(0, 25, 0, 25)
    CloseBtn.Position = UDim2.new(1, -30, 0, 5)
    CloseBtn.Text = "X"
    CloseBtn.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
    CloseBtn.TextColor3 = Color3.new(1, 1, 1)
    CloseBtn.Font = Enum.Font.SourceSansBold
    CloseBtn.TextSize = 16
    CloseBtn.MouseButton1Click:Connect(function()
        savedPosition = Frame.Position
        savedAimbotState = aimbotActive
        savedWallCheckState = wallCheck
        savedESPState = espActive
        ScreenGui:Destroy()
        GunGuiButton.Visible = true
    end)

    -- Função para os botões de ativação/desativação
    criarBotao("Aimbot On/Off", 1, toggleAimbot)
    criarBotao("Wall Check On/Off", 2, toggleWallCheck)
    criarBotao("ESP On/Off", 3, toggleESP)

    -- Restaurar os estados anteriores
    if savedAimbotState then
        toggleAimbot()
    end
    if savedWallCheckState then
        toggleWallCheck()
    end
    if savedESPState then
        toggleESP()
    end
end

-- Estados
aimbotActive = savedAimbotState
wallCheck = savedWallCheckState
espActive = savedESPState
espConnections = {}

local function isVisible(targetPart)
    local origin = workspace.CurrentCamera.CFrame.Position
    local direction = (targetPart.Position - origin).Unit * 1000
    local raycastParams = RaycastParams.new()
    raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
    raycastParams.FilterDescendantsInstances = {game.Players.LocalPlayer.Character}
    local result = workspace:Raycast(origin, direction, raycastParams)
    return not result or result.Instance:IsDescendantOf(targetPart.Parent)
end

local aimConnection
function toggleAimbot()
    aimbotActive = not aimbotActive
    if aimbotActive then
        print("Aimbot ativado")
        aimConnection = game:GetService("RunService").RenderStepped:Connect(function()
            local cam = workspace.CurrentCamera
            local closest, shortestDistance = nil, math.huge
            for _, plr in pairs(game.Players:GetPlayers()) do
                if plr ~= game.Players.LocalPlayer and plr.Character and plr.Character:FindFirstChild("HumanoidRootPart") then
                    local pos, onScreen = cam:WorldToViewportPoint(plr.Character.HumanoidRootPart.Position)
                    if onScreen then
                        local dist = (Vector2.new(pos.X, pos.Y) - Vector2.new(cam.ViewportSize.X / 2, cam.ViewportSize.Y / 2)).Magnitude
                        if dist < shortestDistance and (not wallCheck or isVisible(plr.Character.HumanoidRootPart)) then
                            closest, shortestDistance = plr.Character.HumanoidRootPart, dist
                        end
                    end
                end
            end
            if closest then
                cam.CFrame = CFrame.new(cam.CFrame.Position, closest.Position)
            end
        end)
    else
        print("Aimbot desativado")
        if aimConnection then aimConnection:Disconnect() end
    end
end

function toggleWallCheck()
    wallCheck = not wallCheck
    print("Wall Check: " .. (wallCheck and "Ativado" or "Desativado"))
end

function toggleESP()
    espActive = not espActive

    local function criarESP(plr)
        if plr == game.Players.LocalPlayer or not plr.Character or not plr.Character:FindFirstChild("HumanoidRootPart") then return end
        local hrp = plr.Character.HumanoidRootPart
        if hrp:FindFirstChild("ESPBox") then return end

        local espBox = Instance.new("BoxHandleAdornment", hrp)
        espBox.Size = Vector3.new(4, 6, 2)
        espBox.Adornee = hrp
        espBox.AlwaysOnTop = true
        espBox.ZIndex = 5
        espBox.Transparency = 0.3
        espBox.Color3 = Color3.fromRGB(0, 170, 255)
        espBox.Name = "ESPBox"

        local line = Drawing.new("Line")
        table.insert(espConnections, line)
        line.Thickness = 1.5
        line.Color = Color3.fromRGB(0, 170, 255)
        line.Transparency = 1
        line.Visible = true

        local conn = game:GetService("RunService").RenderStepped:Connect(function()
            if not hrp:IsDescendantOf(workspace) then
                if line then line:Remove() end
                if conn then conn:Disconnect() end
                return
            end
            local cam = workspace.CurrentCamera
            local pos, visible = cam:WorldToViewportPoint(hrp.Position)
            line.Visible = visible
            if visible then
                line.From = Vector2.new(cam.ViewportSize.X / 2, cam.ViewportSize.Y)
                line.To = Vector2.new(pos.X, pos.Y)
            end
        end)
        table.insert(espConnections, conn)
        table.insert(espConnections, hrp.AncestryChanged:Connect(function()
            if not hrp:IsDescendantOf(workspace) then
                espBox:Destroy()
                if line then line:Remove() end
                if conn then conn:Disconnect() end
            end
        end))
    end

    if espActive then
        print("ESP ativado")
        for _, plr in pairs(game.Players:GetPlayers()) do
            if plr.Character then criarESP(plr) end
            table.insert(espConnections, plr.CharacterAdded:Connect(function()
                task.wait(1)
                criarESP(plr)
            end))
        end
        table.insert(espConnections, game.Players.PlayerAdded:Connect(function(plr)
            table.insert(espConnections, plr.CharacterAdded:Connect(function()
                task.wait(1)
                criarESP(plr)
            end))
        end))
    else
        print("ESP desativado")
        for _, plr in pairs(game.Players:GetPlayers()) do
            if plr.Character and plr.Character:FindFirstChild("HumanoidRootPart") then
                local adorn = plr.Character.HumanoidRootPart:FindFirstChild("ESPBox")
                if adorn then adorn:Destroy() end
            end
        end
        for _, v in pairs(espConnections) do
            if typeof(v) == "RBXScriptConnection" then v:Disconnect()
            elseif typeof(v) == "table" and v.Remove then v:Remove() end
        end
        espConnections = {}
    end
end

-- Botões
function criarBotao(texto, ordem, func)
    local alturaBotao = 35
    local espacamento = 10
    local margemSuperior = 40
    local botao = Instance.new("TextButton", Frame)
    botao.Size = UDim2.new(0, 200, 0, alturaBotao)
    botao.Position = UDim2.new(0.5, -100, 0, margemSuperior + (ordem - 1) * (alturaBotao + espacamento))
    botao.Text = texto
    botao.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
    botao.TextColor3 = Color3.new(1, 1, 1)
    botao.Font = Enum.Font.SourceSansBold
    botao.TextSize = 16
    botao.BorderSizePixel = 0
    botao.MouseButton1Click:Connect(func)
end

-- Criar os botões inicialmente
criarBotao("Aimbot On/Off", 1, toggleAimbot)
criarBotao("Wall Check On/Off", 2, toggleWallCheck)
criarBotao("ESP On/Off", 3, toggleESP)

Features & Information

Esse script e para jogo de tiro e universal Tem aimbot esp e wall check

Community Comments (1)

Cara_azul666Cara_azul666Apr 25, 2025

Update

More Scripts for Universal Scripts