local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local player = Players.LocalPlayer
local camera = workspace.CurrentCamera
local aimEnabled = false
local espEnabled = false
local holdingRightClick = false
local holdingIncrease = false
local holdingDecrease = false
local AIM_RADIUS = 150
local AIM_STRENGTH = 0.25
local CHANGE_SPEED = 0.02
local PREDICTION = 0.12
local discordLink = "https://discord.gg/ThpY2qaWSd"
local boxes = {}
-- GUI
local gui = Instance.new("ScreenGui")
gui.Parent = player:WaitForChild("PlayerGui")
gui.ResetOnSpawn = false
local frame = Instance.new("Frame")
frame.Size = UDim2.new(0,220,0,210)
frame.Position = UDim2.new(1,-240,0,30)
frame.BackgroundColor3 = Color3.fromRGB(25,25,25)
frame.Active = true
frame.Draggable = true
frame.Parent = gui
local title = Instance.new("TextLabel")
title.Size = UDim2.new(1,0,0,35)
title.BackgroundTransparency = 1
title.Text = "Hunt Hub"
title.TextColor3 = Color3.new(1,1,1)
title.Font = Enum.Font.GothamBold
title.TextSize = 20
title.Parent = frame
local function makeButton(text,pos)
local b = Instance.new("TextButton")
b.Size = UDim2.new(1,-20,0,40)
b.Position = pos
b.BackgroundColor3 = Color3.fromRGB(40,40,40)
b.TextColor3 = Color3.new(1,1,1)
b.Font = Enum.Font.Gotham
b.TextSize = 16
b.Text = text
b.Parent = frame
return b
end
local aimButton = makeButton("Aim Assist : OFF (Y)",UDim2.new(0,10,0,45))
local espButton = makeButton("ESP : OFF (U)",UDim2.new(0,10,0,95))
local discordButton = makeButton("Join Discord",UDim2.new(0,10,0,145))
-- FOV circle
local circle = Drawing.new("Circle")
circle.Thickness = 2
circle.Radius = AIM_RADIUS
circle.Filled = false
circle.Color = Color3.fromRGB(255,0,0)
circle.Visible = false
-- create box esp
local function createBox(p)
local box = Drawing.new("Square")
box.Thickness = 2
box.Color = Color3.fromRGB(255,0,0)
box.Filled = false
box.Visible = false
boxes[p] = box
end
for _,p in pairs(Players:GetPlayers()) do
if p ~= player then
createBox(p)
end
end
Players.PlayerAdded:Connect(function(p)
if p ~= player then
createBox(p)
end
end)
-- highlight esp
local function applyHighlight(p)
if not p.Character then return end
local h = p.Character:FindFirstChild("Highlight")
if espEnabled then
if not h then
h = Instance.new("Highlight")
h.Parent = p.Character
end
h.FillColor = Color3.fromRGB(255,0,0)
else
if h then
h:Destroy()
end
end
end
-- closest enemy
local function getClosestEnemy()
local closest
local shortest = AIM_RADIUS
local mouse = UserInputService:GetMouseLocation()
for _,p in pairs(Players:GetPlayers()) do
if p ~= player
and p.Team ~= player.Team
and p.Character
and p.Character:FindFirstChild("Head")
and p.Character:FindFirstChild("HumanoidRootPart") then
local pos,vis = camera:WorldToViewportPoint(p.Character.Head.Position)
if vis then
local dist = (Vector2.new(pos.X,pos.Y)-mouse).Magnitude
if dist < shortest then
shortest = dist
closest = p
end
end
end
end
return closest
end
-- controls
UserInputService.InputBegan:Connect(function(input,gp)
if gp then return end
if input.KeyCode == Enum.KeyCode.Y then
aimEnabled = not aimEnabled
aimButton.Text = "Aim Assist : "..(aimEnabled and "ON" or "OFF")
circle.Visible = aimEnabled
end
if input.KeyCode == Enum.KeyCode.U then
espEnabled = not espEnabled
espButton.Text = "ESP : "..(espEnabled and "ON" or "OFF")
for _,p in pairs(Players:GetPlayers()) do
if p ~= player then
applyHighlight(p)
end
end
end
if input.KeyCode == Enum.KeyCode.K then
holdingIncrease = true
end
if input.KeyCode == Enum.KeyCode.C then
holdingDecrease = true
end
if input.UserInputType == Enum.UserInputType.MouseButton2 then
holdingRightClick = true
end
end)
UserInputService.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.K then
holdingIncrease = false
end
if input.KeyCode == Enum.KeyCode.C then
holdingDecrease = false
end
if input.UserInputType == Enum.UserInputType.MouseButton2 then
holdingRightClick = false
end
end)
-- discord button
discordButton.MouseButton1Click:Connect(function()
if setclipboard then
setclipboard(discordLink)
discordButton.Text = "Copied!"
task.wait(2)
discordButton.Text = "Join Discord"
end
end)
-- main loop
RunService.RenderStepped:Connect(function()
if holdingIncrease then
AIM_STRENGTH = math.clamp(AIM_STRENGTH + CHANGE_SPEED,0,1)
end
if holdingDecrease then
AIM_STRENGTH = math.clamp(AIM_STRENGTH - CHANGE_SPEED,0,1)
end
local mouse = UserInputService:GetMouseLocation()
circle.Position = mouse
-- box esp update
for p,box in pairs(boxes) do
if p.Character and p.Character:FindFirstChild("HumanoidRootPart") then
local pos,vis = camera:WorldToViewportPoint(p.Character.HumanoidRootPart.Position)
if vis and espEnabled then
box.Size = Vector2.new(50,80)
box.Position = Vector2.new(pos.X-25,pos.Y-40)
box.Visible = true
else
box.Visible = false
end
end
end
-- aim assist
if aimEnabled and holdingRightClick then
local target = getClosestEnemy()
if target and target.Character then
local head = target.Character.Head
local velocity = target.Character.HumanoidRootPart.Velocity
local predicted = head.Position + velocity * PREDICTION
camera.CFrame = camera.CFrame:Lerp(
CFrame.new(camera.CFrame.Position,predicted),
AIM_STRENGTH
)
end
end
end)
Comments
No comments yet
Be the first to share your thoughts!