Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Configurações
- local Config = {
- ESP = {
- Enabled = true,
- BoxColor = Color3.fromRGB(255, 0, 0),
- TracerColor = Color3.fromRGB(255, 0, 0),
- TextColor = Color3.fromRGB(255, 255, 255),
- TextSize = 14,
- BoxThickness = 1,
- TracerThickness = 1,
- ShowDistance = true -- Nova opção para mostrar distância
- },
- Aimbot = {
- Enabled = true,
- TeamCheck = false,
- VisibilityCheck = true,
- Smoothness = 0.5,
- FOV = 400,
- ShowFOV = true, -- Nova opção para mostrar/ocultar círculo FOV
- TargetPart = "Head" -- Parte do corpo para mirar
- },
- Triggerbot = {
- Enabled = false,
- Delay = 0.1 -- Delay em segundos antes de atirar
- }
- }
- -- Serviços
- local Players = game:GetService("Players")
- local RunService = game:GetService("RunService")
- local UserInputService = game:GetService("UserInputService")
- local Camera = workspace.CurrentCamera
- local LocalPlayer = Players.LocalPlayer
- -- Interface do Usuário
- local ScreenGui = Instance.new("ScreenGui")
- ScreenGui.Parent = game.CoreGui
- local MainFrame = Instance.new("Frame")
- MainFrame.Name = "ConfigUI"
- MainFrame.Size = UDim2.new(0, 300, 0, 400)
- MainFrame.Position = UDim2.new(0.8, 0, 0.5, -200)
- MainFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- MainFrame.BorderSizePixel = 0
- MainFrame.Parent = ScreenGui
- local Title = Instance.new("TextLabel")
- Title.Size = UDim2.new(1, 0, 0, 30)
- Title.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- Title.TextColor3 = Color3.fromRGB(255, 255, 255)
- Title.Text = "Configurações"
- Title.TextSize = 18
- Title.Font = Enum.Font.SourceSansBold
- Title.Parent = MainFrame
- local ScrollingFrame = Instance.new("ScrollingFrame")
- ScrollingFrame.Size = UDim2.new(1, -20, 1, -40)
- ScrollingFrame.Position = UDim2.new(0, 10, 0, 35)
- ScrollingFrame.BackgroundTransparency = 1
- ScrollingFrame.ScrollBarThickness = 6
- ScrollingFrame.Parent = MainFrame
- -- Pool de objetos de interface
- local UIPool = {
- frames = {},
- buttons = {},
- labels = {},
- sliders = {}
- }
- -- Funções do Pool de UI
- local function getOrCreateUIElement(poolType, className, parent)
- local pool = UIPool[poolType]
- -- Procura por um elemento não utilizado no pool
- for _, obj in ipairs(pool) do
- if not obj.InUse then
- obj.InUse = true
- obj.Instance.Parent = parent
- return obj.Instance
- end
- end
- -- Cria novo elemento se não encontrar nenhum disponível
- local newElement = Instance.new(className)
- table.insert(pool, {Instance = newElement, InUse = true})
- newElement.Parent = parent
- return newElement
- end
- local function releaseUIElement(element, poolType)
- local pool = UIPool[poolType]
- for _, obj in ipairs(pool) do
- if obj.Instance == element then
- obj.InUse = false
- element.Parent = nil
- return
- end
- end
- end
- -- Função atualizada para criar toggles usando pool
- local function CreateToggle(name, configTable, configKey, y)
- local Toggle = getOrCreateUIElement("frames", "Frame", ScrollingFrame)
- Toggle.Size = UDim2.new(1, 0, 0, 30)
- Toggle.Position = UDim2.new(0, 0, 0, y)
- Toggle.BackgroundTransparency = 1
- local Label = getOrCreateUIElement("labels", "TextLabel", Toggle)
- Label.Size = UDim2.new(0.7, 0, 1, 0)
- Label.BackgroundTransparency = 1
- Label.Text = name
- Label.TextColor3 = Color3.fromRGB(255, 255, 255)
- Label.TextXAlignment = Enum.TextXAlignment.Left
- local Button = getOrCreateUIElement("buttons", "TextButton", Toggle)
- Button.Size = UDim2.new(0.3, -10, 1, -10)
- Button.Position = UDim2.new(0.7, 5, 0, 5)
- Button.BackgroundColor3 = configTable[configKey] and Color3.fromRGB(0, 255, 0) or Color3.fromRGB(255, 0, 0)
- Button.Text = configTable[configKey] and "ON" or "OFF"
- Button.TextColor3 = Color3.fromRGB(255, 255, 255)
- Button.MouseButton1Click:Connect(function()
- configTable[configKey] = not configTable[configKey]
- Button.BackgroundColor3 = configTable[configKey] and Color3.fromRGB(0, 255, 0) or Color3.fromRGB(255, 0, 0)
- Button.Text = configTable[configKey] and "ON" or "OFF"
- end)
- return Toggle
- end
- -- Função atualizada para criar sliders usando pool
- local function CreateSlider(name, configTable, configKey, min, max, y)
- local Slider = getOrCreateUIElement("frames", "Frame", ScrollingFrame)
- Slider.Size = UDim2.new(1, 0, 0, 50)
- Slider.Position = UDim2.new(0, 0, 0, y)
- Slider.BackgroundTransparency = 1
- local Label = getOrCreateUIElement("labels", "TextLabel", Slider)
- Label.Size = UDim2.new(1, 0, 0, 20)
- Label.BackgroundTransparency = 1
- Label.Text = name
- Label.TextColor3 = Color3.fromRGB(255, 255, 255)
- Label.TextXAlignment = Enum.TextXAlignment.Left
- local SliderBar = getOrCreateUIElement("frames", "Frame", Slider)
- SliderBar.Size = UDim2.new(1, 0, 0, 5)
- SliderBar.Position = UDim2.new(0, 0, 0.7, 0)
- SliderBar.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
- local SliderButton = getOrCreateUIElement("buttons", "TextButton", SliderBar)
- SliderButton.Size = UDim2.new(0.1, 0, 0, 20)
- local initialValue = configTable[configKey]
- local initialPosition = (initialValue - min)/(max - min)
- SliderButton.Position = UDim2.new(initialPosition, -10, 0.5, -10)
- SliderButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- SliderButton.Text = ""
- local ValueLabel = getOrCreateUIElement("labels", "TextLabel", SliderBar)
- ValueLabel.Size = UDim2.new(0, 50, 0, 20)
- ValueLabel.Position = UDim2.new(1, 10, 0.5, -10)
- ValueLabel.BackgroundTransparency = 1
- ValueLabel.Text = tostring(initialValue)
- ValueLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
- local dragging = false
- SliderButton.MouseButton1Down:Connect(function()
- dragging = true
- end)
- UserInputService.InputEnded:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = false
- end
- end)
- UserInputService.InputChanged:Connect(function(input)
- if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
- local mousePos = UserInputService:GetMouseLocation()
- local relativePos = (mousePos.X - SliderBar.AbsolutePosition.X) / SliderBar.AbsoluteSize.X
- relativePos = math.clamp(relativePos, 0, 1)
- local value = min + (max - min) * relativePos
- configTable[configKey] = math.floor(value)
- ValueLabel.Text = tostring(math.floor(value))
- SliderButton.Position = UDim2.new(relativePos, -10, 0.5, -10)
- -- Atualiza o raio do círculo FOV quando o valor é alterado
- if name == "FOV" then
- FOVCircle.Radius = value
- end
- end
- end)
- return Slider
- end
- -- Criando elementos da interface
- local y = 0
- -- ESP Settings
- CreateToggle("ESP Enabled", Config.ESP, "Enabled", y)
- y = y + 40
- CreateToggle("Show Distance", Config.ESP, "ShowDistance", y)
- y = y + 40
- -- Aimbot Settings
- CreateToggle("Aimbot Enabled", Config.Aimbot, "Enabled", y)
- y = y + 40
- CreateToggle("Show FOV", Config.Aimbot, "ShowFOV", y)
- y = y + 40
- CreateToggle("Team Check", Config.Aimbot, "TeamCheck", y)
- y = y + 40
- CreateToggle("Visibility Check", Config.Aimbot, "VisibilityCheck", y)
- y = y + 40
- CreateSlider("Smoothness", Config.Aimbot, "Smoothness", 0, 1, y)
- y = y + 60
- CreateSlider("FOV", Config.Aimbot, "FOV", 50, 800, y)
- y = y + 60
- -- Triggerbot Settings
- CreateToggle("Triggerbot Enabled", Config.Triggerbot, "Enabled", y)
- y = y + 40
- CreateSlider("Trigger Delay", Config.Triggerbot, "Delay", 0, 1, y)
- -- Pool de objetos de desenho
- local DrawingPool = {
- squares = {},
- lines = {},
- texts = {}
- }
- -- Funções do Pool
- local function getOrCreateDrawing(poolType, drawingType)
- local pool = DrawingPool[poolType]
- for i, obj in ipairs(pool) do
- if not obj.InUse then
- obj.InUse = true
- return obj.Drawing
- end
- end
- local newDrawing = Drawing.new(drawingType)
- table.insert(pool, {Drawing = newDrawing, InUse = true})
- return newDrawing
- end
- local function releaseDrawing(drawing, poolType)
- local pool = DrawingPool[poolType]
- for _, obj in ipairs(pool) do
- if obj.Drawing == drawing then
- obj.InUse = false
- drawing.Visible = false
- break
- end
- end
- end
- -- Interface
- local FOVCircle = Drawing.new("Circle")
- FOVCircle.Thickness = 1
- FOVCircle.NumSides = 100
- FOVCircle.Radius = Config.Aimbot.FOV
- FOVCircle.Filled = false
- FOVCircle.Visible = Config.Aimbot.ShowFOV
- FOVCircle.ZIndex = 999
- FOVCircle.Transparency = 0.7
- FOVCircle.Color = Color3.fromRGB(255, 255, 255)
- -- Funções Utilitárias
- local function IsAlive(player)
- local character = player.Character
- local humanoid = character and character:FindFirstChild("Humanoid")
- return character and humanoid and humanoid.Health > 0
- end
- local function IsTeammate(player)
- if not Config.Aimbot.TeamCheck then return false end
- -- Verificar se o jogador tem uma equipe
- if not player.Team or not LocalPlayer.Team then return false end
- -- Retornar true se for da mesma equipe
- return player.Team == LocalPlayer.Team
- end
- local function IsVisible(position)
- if not Config.Aimbot.VisibilityCheck then return true end
- local ray = Ray.new(Camera.CFrame.Position, position - Camera.CFrame.Position)
- local hit = workspace:FindPartOnRayWithIgnoreList(ray, {LocalPlayer.Character, Camera})
- return not hit
- end
- local function GetDistance(position)
- return (Camera.CFrame.Position - position).Magnitude
- end
- -- ESP
- local function CreateESP(player)
- local espObjects = {
- box = getOrCreateDrawing("squares", "Square"),
- tracer = getOrCreateDrawing("lines", "Line"),
- name = getOrCreateDrawing("texts", "Text"),
- distance = getOrCreateDrawing("texts", "Text")
- }
- local connection = RunService.RenderStepped:Connect(function()
- if not Config.ESP.Enabled or not IsAlive(player) or IsTeammate(player) then
- for _, obj in pairs(espObjects) do
- obj.Visible = false
- end
- return
- end
- local character = player.Character
- local cframe = character:GetPivot()
- local position, visible = Camera:WorldToViewportPoint(cframe.Position)
- if visible then
- local distance = GetDistance(cframe.Position)
- local scaleFactor = 1 / (distance * 0.2)
- local size = Vector2.new(2000 * scaleFactor, 2500 * scaleFactor)
- -- Box ESP
- espObjects.box.Size = size
- espObjects.box.Position = Vector2.new(position.X - size.X / 2, position.Y - size.Y / 2)
- espObjects.box.Color = Config.ESP.BoxColor
- espObjects.box.Visible = true
- espObjects.box.Thickness = Config.ESP.BoxThickness
- espObjects.box.Filled = false
- -- Tracer
- espObjects.tracer.From = Vector2.new(Camera.ViewportSize.X / 2, Camera.ViewportSize.Y)
- espObjects.tracer.To = Vector2.new(position.X, position.Y)
- espObjects.tracer.Color = Config.ESP.TracerColor
- espObjects.tracer.Visible = true
- espObjects.tracer.Thickness = Config.ESP.TracerThickness
- -- Name ESP
- espObjects.name.Text = player.Name
- espObjects.name.Position = Vector2.new(position.X, position.Y - size.Y / 2 - 15)
- espObjects.name.Color = Config.ESP.TextColor
- espObjects.name.Size = Config.ESP.TextSize
- espObjects.name.Center = true
- espObjects.name.Visible = true
- -- Distance ESP
- if Config.ESP.ShowDistance then
- espObjects.distance.Text = string.format("%.0fm", distance)
- espObjects.distance.Position = Vector2.new(position.X, position.Y + size.Y / 2 + 5)
- espObjects.distance.Color = Config.ESP.TextColor
- espObjects.distance.Size = Config.ESP.TextSize
- espObjects.distance.Center = true
- espObjects.distance.Visible = true
- else
- espObjects.distance.Visible = false
- end
- else
- for _, obj in pairs(espObjects) do
- obj.Visible = false
- end
- end
- end)
- player.AncestryChanged:Connect(function()
- connection:Disconnect()
- for _, obj in pairs(espObjects) do
- releaseDrawing(obj, "squares")
- end
- end)
- end
- -- Função para calcular o FOV ajustado para a resolução
- local function GetAdjustedFOV()
- local aspectRatio = Camera.ViewportSize.X / Camera.ViewportSize.Y
- local baseAspectRatio = 16/9 -- Aspecto padrão
- -- Ajusta o FOV baseado na proporção da tela
- if aspectRatio > baseAspectRatio then
- return Config.Aimbot.FOV * (baseAspectRatio / aspectRatio)
- end
- return Config.Aimbot.FOV
- end
- -- Função atualizada para obter o jogador mais próximo
- local function GetClosestPlayer()
- local closestPlayer = nil
- local shortestDistance = math.huge
- local mousePos = Vector2.new(Camera.ViewportSize.X / 2, Camera.ViewportSize.Y / 2)
- local adjustedFOV = GetAdjustedFOV()
- for _, player in pairs(Players:GetPlayers()) do
- if player ~= LocalPlayer and IsAlive(player) and not IsTeammate(player) then
- local character = player.Character
- local targetPart = character:FindFirstChild(Config.Aimbot.TargetPart)
- if targetPart then
- local pos, onScreen = Camera:WorldToViewportPoint(targetPart.Position)
- if onScreen then
- local targetPos = Vector2.new(pos.X, pos.Y)
- -- Calcula a distância ajustada para a proporção da tela
- local deltaX = (targetPos.X - mousePos.X) / (Camera.ViewportSize.X / 1920)
- local deltaY = (targetPos.Y - mousePos.Y) / (Camera.ViewportSize.Y / 1080)
- local distance = math.sqrt(deltaX * deltaX + deltaY * deltaY)
- -- Verifica se o alvo está dentro do FOV ajustado
- if distance <= adjustedFOV then
- if IsVisible(targetPart.Position) then
- if distance < shortestDistance then
- closestPlayer = player
- shortestDistance = distance
- end
- end
- end
- end
- end
- end
- end
- return closestPlayer, shortestDistance
- end
- -- Inicialização
- for _, player in pairs(Players:GetPlayers()) do
- if player ~= LocalPlayer then
- CreateESP(player)
- end
- end
- Players.PlayerAdded:Connect(function(player)
- CreateESP(player)
- end)
- -- Função para limpar a interface
- local function CleanupUI()
- for poolType, pool in pairs(UIPool) do
- for _, obj in ipairs(pool) do
- if obj.InUse then
- releaseUIElement(obj.Instance, poolType)
- end
- end
- end
- end
- -- Tecla para mostrar/esconder a interface
- UserInputService.InputBegan:Connect(function(input)
- if input.KeyCode == Enum.KeyCode.RightShift then
- if not MainFrame.Visible then
- CleanupUI()
- end
- MainFrame.Visible = not MainFrame.Visible
- end
- end)
- -- Cache de valores calculados frequentemente
- local cachedValues = {
- adjustedFOV = 0,
- screenCenter = Vector2.new(),
- lastTargetCheck = 0,
- lastAimbotUpdate = 0,
- lastTriggerCheck = 0
- }
- -- Constantes para otimização
- local UPDATE_INTERVAL = 1/60 -- 60Hz
- local TRIGGER_CHECK_INTERVAL = 1/30 -- 30Hz
- local TARGET_CHECK_INTERVAL = 1/20 -- 20Hz
- -- Função otimizada para atualizar valores em cache
- local function updateCachedValues()
- local currentTime = tick()
- -- Atualiza valores apenas se necessário
- if currentTime - cachedValues.lastTargetCheck >= TARGET_CHECK_INTERVAL then
- cachedValues.adjustedFOV = GetAdjustedFOV()
- cachedValues.screenCenter = Vector2.new(Camera.ViewportSize.X / 2, Camera.ViewportSize.Y / 2)
- cachedValues.lastTargetCheck = currentTime
- end
- end
- -- Função otimizada para verificar condições do Triggerbot
- local function shouldTriggerFire(target, targetPos)
- if not Config.Triggerbot.Enabled then return false end
- if not target or not target.Character then return false end
- local currentTime = tick()
- if currentTime - lastTriggerTime < Config.Triggerbot.Delay then return false end
- -- Verifica se o mouse está realmente sobre o alvo
- local mousePos = UserInputService:GetMouseLocation()
- local targetScreenPos = Vector2.new(targetPos.X, targetPos.Y)
- local distance = (mousePos - targetScreenPos).Magnitude
- -- Adiciona verificações adicionais
- return distance < 5 and
- IsVisible(target.Character[Config.Aimbot.TargetPart].Position) and
- not IsTeammate(target) and
- IsAlive(target)
- end
- -- Loop Principal otimizado
- RunService.RenderStepped:Connect(function()
- local currentTime = tick()
- updateCachedValues()
- -- Atualiza o círculo FOV apenas quando necessário
- if Config.Aimbot.ShowFOV and Config.Aimbot.Enabled then
- FOVCircle.Position = cachedValues.screenCenter
- FOVCircle.Radius = cachedValues.adjustedFOV
- FOVCircle.Visible = true
- else
- FOVCircle.Visible = false
- end
- -- Aimbot
- if Config.Aimbot.Enabled and
- UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton2) and
- currentTime - cachedValues.lastAimbotUpdate >= UPDATE_INTERVAL then
- local target, distance = GetClosestPlayer()
- if target and target.Character then
- local targetPart = target.Character:FindFirstChild(Config.Aimbot.TargetPart)
- if targetPart then
- local pos = Camera:WorldToViewportPoint(targetPart.Position)
- local targetPos = Vector2.new(pos.X, pos.Y)
- -- Cálculos otimizados do movimento
- local deltaX = (targetPos.X - cachedValues.screenCenter.X) / (Camera.ViewportSize.X / 1920)
- local deltaY = (targetPos.Y - cachedValues.screenCenter.Y) / (Camera.ViewportSize.Y / 1080)
- local delta = Vector2.new(deltaX, deltaY)
- local smoothness = math.clamp(1 - Config.Aimbot.Smoothness, 0.1, 1)
- local strength = math.min(1, cachedValues.adjustedFOV / distance)
- local finalDelta = delta * smoothness * strength
- -- Movimento otimizado
- if finalDelta.Magnitude > 0.1 then -- Evita micromovimentos
- mousemoverel(
- finalDelta.X * (Camera.ViewportSize.X / 1920),
- finalDelta.Y * (Camera.ViewportSize.Y / 1080)
- )
- end
- cachedValues.lastAimbotUpdate = currentTime
- end
- end
- end
- -- Triggerbot otimizado
- if currentTime - cachedValues.lastTriggerCheck >= TRIGGER_CHECK_INTERVAL then
- local target = GetClosestPlayer()
- if target then
- local targetPart = target.Character and target.Character:FindFirstChild(Config.Aimbot.TargetPart)
- if targetPart then
- local pos = Camera:WorldToViewportPoint(targetPart.Position)
- if shouldTriggerFire(target, pos) then
- mouse1press()
- wait(0.05) -- Pequeno delay para simular clique real
- mouse1release()
- lastTriggerTime = currentTime
- end
- end
- end
- cachedValues.lastTriggerCheck = currentTime
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment