Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local fov, RunService, UserInputService, Players, Cam, CoreGui, isAimbotActive, dragging, dragInput, dragStart, startPos, toggleButton = 100, game:GetService("RunService"), game:GetService("UserInputService"), game:GetService("Players"), game.Workspace.CurrentCamera, game:FindService("CoreGui"), false, false, nil, nil, nil, Instance.new("TextButton")
- local FOVring, playerNameText = Drawing.new("Circle"), Drawing.new("Text")
- FOVring.Visible, FOVring.Thickness, FOVring.Color, FOVring.Filled, FOVring.Radius, FOVring.Position = true, 2, Color3.fromRGB(128, 0, 128), false, fov, Cam.ViewportSize / 2
- playerNameText.Visible, playerNameText.Center, playerNameText.Outline, playerNameText.Color, playerNameText.Size, playerNameText.Position = false, true, true, Color3.fromRGB(255, 255, 255), 18, Vector2.new(FOVring.Position.X, FOVring.Position.Y - FOVring.Radius - 20)
- local function updateDrawings()
- FOVring.Position, playerNameText.Position = Cam.ViewportSize / 2, Vector2.new(FOVring.Position.X, FOVring.Position.Y - FOVring.Radius - 20)
- end
- local function onKeyDown(input)
- if input.KeyCode == Enum.KeyCode.Delete then
- RunService:UnbindFromRenderStep("FOVUpdate")
- FOVring:Remove()
- playerNameText:Remove()
- elseif input.KeyCode == Enum.KeyCode.F5 then
- toggleButton.Visible = not toggleButton.Visible
- end
- end
- UserInputService.InputBegan:Connect(onKeyDown)
- local function lookAt(target)
- Cam.CFrame = CFrame.new(Cam.CFrame.Position, Cam.CFrame.Position + (target - Cam.CFrame.Position).unit)
- end
- local function getClosestPlayerInFOV(trg_part)
- local nearest, last = nil, math.huge
- for _, player in ipairs(Players:GetPlayers()) do
- if player ~= Players.LocalPlayer and player.Team ~= Players.LocalPlayer.Team then
- local part = player.Character and player.Character:FindFirstChild(trg_part)
- if part then
- local ePos, isVisible = Cam:WorldToViewportPoint(part.Position)
- if (Vector2.new(ePos.x, ePos.y) - Cam.ViewportSize / 2).Magnitude < last and isVisible and ePos.Z < fov and not workspace:Raycast(Cam.CFrame.Position, part.Position - Cam.CFrame.Position) then
- last, nearest = (Vector2.new(ePos.x, ePos.y) - Cam.ViewportSize / 2).Magnitude, player
- end
- end
- end
- end
- return nearest
- end
- local player, screenGui = Players.LocalPlayer, Instance.new("ScreenGui")
- screenGui.Name, screenGui.Parent = "AimbotGui", player:WaitForChild("PlayerGui")
- toggleButton.Name, toggleButton.Size, toggleButton.Position, toggleButton.Text, toggleButton.BackgroundTransparency, toggleButton.TextColor3, toggleButton.Parent = "ToggleButton", UDim2.new(0, 150, 0, 50), UDim2.new(0.1, 0, 0.1, 0), "ON", 1, Color3.fromRGB(0, 255, 0), screenGui
- local function toggleAimbot()
- isAimbotActive = not isAimbotActive
- toggleButton.Text, toggleButton.TextColor3, FOVring.Visible, playerNameText.Visible = isAimbotActive and "OFF" or "ON", Color3.fromRGB(0, 255, 0), isAimbotActive, isAimbotActive
- end
- local function updateInput(input)
- local delta = input.Position - dragStart
- toggleButton.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
- end
- local function onDragStart(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging, dragStart, startPos = true, input.Position, toggleButton.Position
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- dragging = false
- end
- end)
- end
- end
- local function onDrag(input)
- if dragging then
- updateInput(input)
- end
- end
- UserInputService.InputBegan:Connect(onDragStart)
- UserInputService.InputChanged:Connect(onDrag)
- toggleButton.MouseButton1Click:Connect(toggleAimbot)
- local closeButton = Instance.new("TextButton")
- closeButton.Name, closeButton.Size, closeButton.Position, closeButton.Text, closeButton.TextColor3, closeButton.BackgroundTransparency, closeButton.Parent = "CloseButton", UDim2.new(0, 30, 0, 30), UDim2.new(0, toggleButton.Size.X.Offset - 15, 0, -15), "X", Color3.fromRGB(255, 255, 255), 1, toggleButton
- local function closeToggleButton()
- toggleButton.Visible, FOVring, playerNameText = false, FOVring:Remove(), playerNameText:Remove()
- end
- closeButton.MouseButton1Click:Connect(closeToggleButton)
- RunService.RenderStepped:Connect(function()
- if isAimbotActive then
- updateDrawings()
- local closest = getClosestPlayerInFOV("Head")
- if closest and closest.Character:FindFirstChild("Head") then
- lookAt(closest.Character.Head.Position)
- playerNameText.Text, playerNameText.Visible = closest.Name, true
- else
- playerNameText.Visible = false
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement