Skip to content

Yo #183

@cloxz19

Description

@cloxz19

-- Cloxz Pro (Roblox)
-- Draggable menu (toggle with C), checkboxes saved, skeleton ESP, nearest-target aimbot,
-- bullets redirection helpers (hitscan direction / homing projectile)
-- Place this LocalScript in StarterPlayerScripts

-- Services
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local HttpService = game:GetService("HttpService")

local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
local Camera = workspace.CurrentCamera
local Mouse = LocalPlayer:GetMouse()

-- ======= CONFIG (editable) =======
local CONFIG = {
UI = {
ThemeMain = Color3.fromRGB(115, 0, 140),
ThemeAccent = Color3.fromRGB(200, 80, 200),
TextColor = Color3.fromRGB(255,255,255),
},
Visuals = {
SkeletonColor = Color3.fromRGB(170, 80, 220),
SkeletonThickness = 0.16,
DistanceCull = 800, -- 0 disables culling
},
Aimbot = {
Enabled = true,
ContinuousLock = false,
AimWhileShooting = true,
AimCamera = false, -- IMPORTANT: default OFF so player movement won't be affected
FOV = 180,
MaxDistance = 800,
Smooth = false,
SmoothSpeed = 0.28,
Mode = "projectile", -- "hitscan" or "projectile"
ProjectileSpeed = 300,
},
SaveValueName = "CloxzSettings", -- StringValue child of Player to save settings (client-only)
}

local SKELETON_FOLDER = "CloxzSkeleton"
local active = true
local connections = {}

-- ======= SAVE / LOAD SETTINGS (client-side) =======
local function ensureSettingsValue()
local v = LocalPlayer:FindFirstChild(CONFIG.SaveValueName)
if not v then
v = Instance.new("StringValue")
v.Name = CONFIG.SaveValueName
v.Value = "" -- empty until saved
v.Parent = LocalPlayer
end
return v
end

local function saveSettings(tbl)
local ok, json = pcall(function() return HttpService:JSONEncode(tbl) end)
if not ok then return end
local v = ensureSettingsValue()
v.Value = json
end

local function loadSettings()
local v = ensureSettingsValue()
if not v.Value or v.Value == "" then return nil end
local ok, tbl = pcall(function() return HttpService:JSONDecode(v.Value) end)
if not ok then return nil end
return tbl
end

-- Convert current CONFIG values into a small state table
local function exportState()
return {
Aimbot = {
Enabled = CONFIG.Aimbot.Enabled,
ContinuousLock = CONFIG.Aimbot.ContinuousLock,
AimWhileShooting = CONFIG.Aimbot.AimWhileShooting,
AimCamera = CONFIG.Aimbot.AimCamera,
FOV = CONFIG.Aimbot.FOV,
MaxDistance = CONFIG.Aimbot.MaxDistance,
Smooth = CONFIG.Aimbot.Smooth,
SmoothSpeed = CONFIG.Aimbot.SmoothSpeed,
Mode = CONFIG.Aimbot.Mode,
ProjectileSpeed = CONFIG.Aimbot.ProjectileSpeed,
},
Visuals = {
SkeletonVisible = true, -- we treat skeleton visibility UI separately; default true
SkeletonColor = {CONFIG.Visuals.SkeletonColor.R, CONFIG.Visuals.SkeletonColor.G, CONFIG.Visuals.SkeletonColor.B},
SkeletonThickness = CONFIG.Visuals.SkeletonThickness,
DistanceCull = CONFIG.Visuals.DistanceCull,
}
}
end

local function importState(tbl)
if not tbl then return end
if tbl.Aimbot then
for k,v in pairs(tbl.Aimbot) do if CONFIG.Aimbot[k] ~= nil then CONFIG.Aimbot[k] = v end end
end
if tbl.Visuals then
local s = tbl.Visuals
if s.SkeletonColor then
CONFIG.Visuals.SkeletonColor = Color3.new(s.SkeletonColor[1], s.SkeletonColor[2], s.SkeletonColor[3])
end
if s.SkeletonThickness then CONFIG.Visuals.SkeletonThickness = s.SkeletonThickness end
if s.DistanceCull then CONFIG.Visuals.DistanceCull = s.DistanceCull end
end
end

-- load on start (if saved)
local saved = loadSettings()
if saved then importState(saved) end

-- ======= HELPERS (parts, skeletons, cleanup) =======
local function getPart(character, names)
for _, n in ipairs(names) do
local p = character:FindFirstChild(n)
if p and p:IsA("BasePart") then return p end
end
return nil
end

local function getStandardParts(character)
return {
Head = getPart(character, {"Head"}),
UpperTorso = getPart(character, {"UpperTorso","Torso","HumanoidRootPart"}),
LowerTorso = getPart(character, {"LowerTorso","Torso","HumanoidRootPart"}),
LArm = getPart(character, {"LeftUpperArm","Left Arm"}),
RArm = getPart(character, {"RightUpperArm","Right Arm"}),
LLeg = getPart(character, {"LeftUpperLeg","Left Leg"}),
RLeg = getPart(character, {"RightUpperLeg","Right Leg"}),
}
end

local function clearSkeleton(character)
if not character then return end
local f = character:FindFirstChild(SKELETON_FOLDER)
if f then pcall(function() f:Destroy() end) end
end

local function createAttachment(part, name)
if not part then return nil end
local att = Instance.new("Attachment")
att.Name = name
att.Parent = part
att.Position = Vector3.new(0,0,0)
return att
end

local function createBeam(attA, attB, color, thickness)
if not attA or not attB then return nil end
local beam = Instance.new("Beam")
beam.Name = "CloxzBeam_"..attA.Name.."_"..attB.Name
beam.Attachment0 = attA
beam.Attachment1 = attB
beam.FaceCamera = true
beam.LightEmission = 0.35
beam.Transparency = NumberSequence.new(0)
beam.Width0 = thickness
beam.Width1 = thickness
beam.Color = ColorSequence.new(color)
beam.Parent = attA.Parent
return beam
end

local function buildSkeletonForCharacter(character)
if not (character and character.Parent) then return end
-- distance culling
if CONFIG.Visuals.DistanceCull > 0 and LocalPlayer.Character and LocalPlayer.Character.PrimaryPart and character.PrimaryPart then
local d = (character.PrimaryPart.Position - LocalPlayer.Character.PrimaryPart.Position).Magnitude
if d > CONFIG.Visuals.DistanceCull then return end
end

local parts = getStandardParts(character)
if not parts.Head or not parts.UpperTorso then return end

clearSkeleton(character)
local folder = Instance.new("Folder")
folder.Name = SKELETON_FOLDER
folder.Parent = character

local atts = {}
for name, part in pairs(parts) do
    if part then atts[name] = createAttachment(part, "Cloxz_"..name) end
end

local function pair(a,b)
    if atts[a] and atts[b] then
        local beam = createBeam(atts[a], atts[b], CONFIG.Visuals.SkeletonColor, CONFIG.Visuals.SkeletonThickness)
        if beam then
            local ov = Instance.new("ObjectValue")
            ov.Name = "beam_"..a.."_"..b
            ov.Value = beam
            ov.Parent = folder
        end
    end
end

pair("Head","UpperTorso")
pair("UpperTorso","LowerTorso")
pair("LowerTorso","LLeg")
pair("LowerTorso","RLeg")
pair("UpperTorso","LArm")
pair("UpperTorso","RArm")

end

-- Build skeletons for players and connect respawn handling
local function attachPlayerSkeletonHandlers()
for _, pl in ipairs(Players:GetPlayers()) do
if pl.Character then buildSkeletonForCharacter(pl.Character) end
connections[#connections + 1] = pl.CharacterAdded:Connect(function()
wait(0.08)
if active then buildSkeletonForCharacter(pl.Character) end
end)
connections[#connections + 1] = pl.CharacterRemoving:Connect(function()
clearSkeleton(pl.Character)
end)
end
connections[#connections + 1] = Players.PlayerAdded:Connect(function(pl)
connections[#connections + 1] = pl.CharacterAdded:Connect(function()
wait(0.08)
if active then buildSkeletonForCharacter(pl.Character) end
end)
end)
connections[#connections + 1] = Players.PlayerRemoving:Connect(function(pl)
clearSkeleton(pl.Character)
end)
end
attachPlayerSkeletonHandlers()

-- update beams every frame
connections[#connections + 1] = RunService.RenderStepped:Connect(function()
if not active then return end
for _, pl in ipairs(Players:GetPlayers()) do
if pl ~= LocalPlayer and pl.Character and pl.Character.Parent then
local folder = pl.Character:FindFirstChild(SKELETON_FOLDER)
if folder then
for _, child in ipairs(folder:GetChildren()) do
if child:IsA("ObjectValue") and child.Value and child.Value:IsA("Beam") then
local beam = child.Value
beam.Color = ColorSequence.new(CONFIG.Visuals.SkeletonColor)
beam.Width0 = CONFIG.Visuals.SkeletonThickness
beam.Width1 = CONFIG.Visuals.SkeletonThickness
end
end
else
-- rebuild if missing
buildSkeletonForCharacter(pl.Character)
end
end
end
end)

-- ======= TARGET SELECTION: nearest target =======
local function isValidTarget(plr)
if not plr or plr == LocalPlayer then return false end
if not plr.Character or not plr.Character.Parent then return false end
local hum = plr.Character:FindFirstChildOfClass("Humanoid")
if hum and hum.Health <= 0 then return false end
local root = plr.Character:FindFirstChild("HumanoidRootPart") or plr.Character:FindFirstChild("Torso") or plr.Character:FindFirstChild("Head")
return root ~= nil
end

local function chooseNearestTarget()
local lpChar = LocalPlayer.Character
if not (lpChar and lpChar.PrimaryPart) then return nil end
local lpRoot = lpChar:FindFirstChild("HumanoidRootPart") or lpChar.PrimaryPart
if not lpRoot then return nil end

local best, bestDist = nil, math.huge
for _, pl in ipairs(Players:GetPlayers()) do
    if isValidTarget(pl) then
        local tr = pl.Character:FindFirstChild("HumanoidRootPart") or pl.Character:FindFirstChild("Head") or pl.Character:FindFirstChild("Torso")
        if tr then
            local d = (tr.Position - lpRoot.Position).Magnitude
            if (CONFIG.Aimbot.MaxDistance <= 0) or d <= CONFIG.Aimbot.MaxDistance then
                if d < bestDist then
                    bestDist = d
                    best = pl
                end
            end
        end
    end
end
return best

end

-- ======= AIM helpers =======
local aimTweenConn = nil
local function smoothAimTo(targetPos, speed)
if aimTweenConn then aimTweenConn:Disconnect(); aimTweenConn = nil end
local start = Camera.CFrame
local camPos = start.Position
local goal = CFrame.new(camPos, targetPos)
local t = 0
local duration = math.clamp(1 - math.clamp(speed, 0, 0.99), 0.02, 0.6)
aimTweenConn = RunService.RenderStepped:Connect(function(dt)
t = t + dt
local a = math.clamp(t / duration, 0, 1)
a = a * a * (3 - 2 * a)
Camera.CFrame = start:Lerp(goal, a)
if a >= 1 then aimTweenConn:Disconnect(); aimTweenConn = nil end
end)
end

local function instantAimTo(targetPos)
Camera.CFrame = CFrame.new(Camera.CFrame.Position, targetPos)
end

-- ======= FIRE helpers (call from your gun) =======
local function dirToTarget(origin, targetPos)
local d = (targetPos - origin)
if d.Magnitude == 0 then return Vector3.new(0,0,-1) end
return d.Unit
end

local function computeHitscanAimPosition(gunOrigin)
local target = chooseNearestTarget()
if not target or not target.Character then return nil end
local tgtPart = target.Character:FindFirstChild("Head") or target.Character:FindFirstChild("HumanoidRootPart") or target.Character:FindFirstChild("Torso")
if not tgtPart then return nil end
return tgtPart.Position
end

local function spawnLocalProjectile(originPos, targetPlayer, speed)
if not targetPlayer or not targetPlayer.Character then return nil end
local tgtPart = targetPlayer.Character:FindFirstChild("Head") or targetPlayer.Character:FindFirstChild("HumanoidRootPart") or targetPlayer.Character:FindFirstChild("Torso")
if not tgtPart then return nil end

local bullet = Instance.new("Part")
bullet.Size = Vector3.new(0.2,0.2,0.2)
bullet.Shape = Enum.PartType.Ball
bullet.CanCollide = false
bullet.Anchored = false
bullet.CFrame = CFrame.new(originPos)
bullet.Parent = workspace

local bv = Instance.new("BodyVelocity", bullet)
bv.MaxForce = Vector3.new(1e5,1e5,1e5)
bv.Velocity = Vector3.new(0,0,0)

local conn
conn = RunService.RenderStepped:Connect(function()
    if not bullet or not bullet.Parent or not tgtPart or not tgtPart.Parent or not active then
        if conn then conn:Disconnect() end
        if bullet and bullet.Parent then pcall(function() bullet:Destroy() end) end
        return
    end
    local dir = (tgtPart.Position - bullet.Position)
    if dir.Magnitude < 1.2 then
        -- local hit handling (if you want to call your damage system, call it here)
        if conn then conn:Disconnect() end
        if bullet and bullet.Parent then pcall(function() bullet:Destroy() end) end
        return
    end
    local v = dir.Unit * speed
    bv.Velocity = v
end)

delay(6, function() if bullet and bullet.Parent then pcall(function() bullet:Destroy() end) end end)
return bullet

end

-- Unified fire function to call from your gun:
-- returns targetPos for hitscan, or spawned bullet part for projectile.
local function fireWithAimbot(gunOrigin, isHitscan, projectileSpeed)
if not CONFIG.Aimbot.Enabled then return nil end
local target = chooseNearestTarget()
if not target or not target.Character then return nil end
local tgtPart = target.Character:FindFirstChild("Head") or target.Character:FindFirstChild("HumanoidRootPart") or target.Character:FindFirstChild("Torso")
if not tgtPart then return nil end
local targetPos = tgtPart.Position

if CONFIG.Aimbot.AimCamera then
    if CONFIG.Aimbot.Smooth then
        smoothAimTo(targetPos, CONFIG.Aimbot.SmoothSpeed)
    else
        instantAimTo(targetPos)
    end
end

if isHitscan then
    return targetPos
else
    return spawnLocalProjectile(gunOrigin, target, projectileSpeed or CONFIG.Aimbot.ProjectileSpeed)
end

end

-- ======= INPUT & CONTINUOUS LOCK =======
local isFiring = false
connections[#connections + 1] = Mouse.Button1Down:Connect(function() isFiring = true end)
connections[#connections + 1] = Mouse.Button1Up:Connect(function() isFiring = false end)
connections[#connections + 1] = UserInputService.InputBegan:Connect(function(input, processed)
if processed then return end
if input.UserInputType == Enum.UserInputType.Touch then isFiring = true end
if input.KeyCode == Enum.KeyCode.ButtonR2 or input.KeyCode == Enum.KeyCode.ButtonR1 or input.KeyCode == Enum.KeyCode.ButtonA then isFiring = true end
-- Toggle menu with C
if input.KeyCode == Enum.KeyCode.C then
local g = PlayerGui:FindFirstChild("CloxzMenuGui")
if g and g.Parent then
g.Enabled = not g.Enabled
end
end
end)
connections[#connections + 1] = UserInputService.InputEnded:Connect(function(input, processed)
if processed then return end
if input.UserInputType == Enum.UserInputType.Touch then isFiring = false end
if input.KeyCode == Enum.KeyCode.ButtonR2 or input.KeyCode == Enum.KeyCode.ButtonR1 or input.KeyCode == Enum.KeyCode.ButtonA then isFiring = false end
end)

-- Continuous lock render loop
connections[#connections + 1] = RunService.RenderStepped:Connect(function()
if not active then return end
if CONFIG.Aimbot.Enabled then
local shouldLock = CONFIG.Aimbot.ContinuousLock or (CONFIG.Aimbot.AimWhileShooting and isFiring)
if shouldLock then
local target = chooseNearestTarget()
if target and target.Character then
local tgtPart = target.Character:FindFirstChild("Head") or target.Character:FindFirstChild("HumanoidRootPart") or target.Character:FindFirstChild("Torso")
if tgtPart then
if CONFIG.Aimbot.AimCamera then
if CONFIG.Aimbot.Smooth then
smoothAimTo(tgtPart.Position, CONFIG.Aimbot.SmoothSpeed)
else
instantAimTo(tgtPart.Position)
end
end
end
end
end
end
end)

-- ======= UI (draggable, checkboxes that save & show green) =======
local function makeUI()
-- remove existing if any
local existing = PlayerGui:FindFirstChild("CloxzMenuGui")
if existing then existing:Destroy() end

local screen = Instance.new("ScreenGui")
screen.Name = "CloxzMenuGui"
screen.ResetOnSpawn = false
screen.Parent = PlayerGui
screen.Enabled = true

local main = Instance.new("Frame")
main.Name = "Main"
main.Size = UDim2.new(0, 420, 0, 230)
main.Position = UDim2.new(0.5, -210, 0.06, 0)
main.AnchorPoint = Vector2.new(0.5, 0)
main.BackgroundColor3 = CONFIG.UI.ThemeMain
main.BorderSizePixel = 0
main.Parent = screen
local mc = Instance.new("UICorner", main); mc.CornerRadius = UDim.new(0, 10)

local header = Instance.new("Frame", main)
header.Size = UDim2.new(1, 0, 0, 46)
header.BackgroundTransparency = 1
header.Active = true

local title = Instance.new("TextLabel", header)
title.Size = UDim2.new(0.6, 0, 1, 0)
title.Position = UDim2.new(0, 12, 0, 0)
title.BackgroundTransparency = 1
title.Text = "Cloxz Menu"
title.Font = Enum.Font.GothamBold
title.TextSize = 18
title.TextColor3 = CONFIG.UI.TextColor
title.TextXAlignment = Enum.TextXAlignment.Left

local exit = Instance.new("TextButton", header)
exit.Size = UDim2.new(0, 64, 0, 30)
exit.Position = UDim2.new(1, -76, 0.5, -15)
exit.Text = "Exit"
exit.Font = Enum.Font.GothamBold
exit.TextSize = 14
exit.BackgroundColor3 = CONFIG.UI.ThemeAccent
exit.TextColor3 = CONFIG.UI.TextColor
local exitCorner = Instance.new("UICorner", exit); exitCorner.CornerRadius = UDim.new(0, 6)
exit.MouseButton1Click:Connect(function()
    -- save current settings before exit
    saveSettings(exportState())
    cleanupAll()
end)

-- draggable header
local dragging, dragStart, startPos = false, nil, nil
header.InputBegan:Connect(function(inp)
    if inp.UserInputType == Enum.UserInputType.MouseButton1 or inp.UserInputType == Enum.UserInputType.Touch then
        dragging = true
        dragStart = inp.Position
        startPos = main.Position
    end
end)
header.InputChanged:Connect(function(inp)
    if not dragging then return end
    if inp.UserInputType == Enum.UserInputType.MouseMovement or inp.UserInputType == Enum.UserInputType.Touch then
        local delta = inp.Position - dragStart
        main.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
    end
end)
header.InputEnded:Connect(function(inp)
    if inp.UserInputType == Enum.UserInputType.MouseButton1 or inp.UserInputType == Enum.UserInputType.Touch then
        dragging = false
    end
end)

-- helper: create checkbox (green = on) and auto-save on toggle
local function createCheckbox(parent, labelText, initialState, pos, onToggle)
    local container = Instance.new("Frame", parent)
    container.Size = UDim2.new(0, 200, 0, 36)
    container.Position = pos
    container.BackgroundTransparency = 1

    local lbl = Instance.new("TextLabel", container)
    lbl.Size = UDim2.new(1, -40, 1, 0)
    lbl.BackgroundTransparency = 1
    lbl.Text = labelText
    lbl.TextColor3 = CONFIG.UI.TextColor
    lbl.Font = Enum.Font.Gotham
    lbl.TextSize = 14
    lbl.TextXAlignment = Enum.TextXAlignment.Left

    local box = Instance.new("Frame", container)
    box.Size = UDim2.new(0, 22, 0, 22)
    box.Position = UDim2.new(1, -26, 0, 7)
    box.BackgroundColor3 = initialState and Color3.fromRGB(0, 200, 0) or Color3.fromRGB(80, 80, 80)
    local corner = Instance.new("UICorner", box); corner.CornerRadius = UDim.new(0, 6)

    local checked = initialState
    container.InputBegan:Connect(function(inp)
        if inp.UserInputType == Enum.UserInputType.MouseButton1 or inp.UserInputType == Enum.UserInputType.Touch then
            checked = not checked
            box.BackgroundColor3 = checked and Color3.fromRGB(0, 200, 0) or Color3.fromRGB(80, 80, 80)
            -- call toggle
            pcall(onToggle, checked)
            -- auto save small state (Aimbot + Visuals)
            saveSettings(exportState())
        end
    end)
    return container, function(value) -- setter
        checked = value
        box.BackgroundColor3 = checked and Color3.fromRGB(0, 200, 0) or Color3.fromRGB(80, 80, 80)
    end
end

-- helper: slider (same style as earlier)
local function createSlider(parent, label, minV, maxV, startV, pos, onChange)
    local c = Instance.new("Frame", parent)
    c.Size = UDim2.new(0, 200, 0, 56)
    c.Position = pos
    c.BackgroundTransparency = 1

    local lbl = Instance.new("TextLabel", c)
    lbl.Size = UDim2.new(1, 0, 0, 18)
    lbl.BackgroundTransparency = 1
    lbl.Text = label .. ": " .. tostring(startV)
    lbl.Font = Enum.Font.Gotham
    lbl.TextSize = 14
    lbl.TextColor3 = CONFIG.UI.TextColor
    lbl.TextXAlignment = Enum.TextXAlignment.Left

    local track = Instance.new("Frame", c)
    track.Size = UDim2.new(1, 0, 0, 16)
    track.Position = UDim2.new(0, 0, 0, 28)
    track.BackgroundColor3 = Color3.fromRGB(60, 60, 70)
    local trCorner = Instance.new("UICorner", track); trCorner.CornerRadius = UDim.new(0, 8)

    local fill = Instance.new("Frame", track)
    local pct = (startV - minV) / (maxV - minV)
    fill.Size = UDim2.new(pct, 0, 1, 0)
    fill.BackgroundColor3 = CONFIG.UI.ThemeAccent
    local fillCorner = Instance.new("UICorner", fill); fillCorner.CornerRadius = UDim.new(0, 8)

    local dragging = false
    track.InputBegan:Connect(function(inp)
        if inp.UserInputType == Enum.UserInputType.MouseButton1 or inp.UserInputType == Enum.UserInputType.Touch then
            dragging = true
            local function update(px)
                local absX = px - track.AbsolutePosition.X
                absX = math.clamp(absX, 0, track.AbsoluteSize.X)
                local newPct = absX / track.AbsoluteSize.X
                fill.Size = UDim2.new(newPct, 0, 1, 0)
                local val = math.floor(minV + newPct * (maxV - minV) + 0.5)
                lbl.Text = label .. ": " .. tostring(val)
                pcall(onChange, val)
                -- auto-save small state
                saveSettings(exportState())
            end
            update(inp.Position.X)
            local mvConn
            mvConn = UserInputService.InputChanged:Connect(function(i)
                if dragging and (i.UserInputType == Enum.UserInputType.MouseMovement or i.UserInputType == Enum.UserInputType.Touch) then
                    update(i.Position.X)
                end
            end)
            local upConn
            upConn = UserInputService.InputEnded:Connect(function(i)
                if i.UserInputType == inp.UserInputType then
                    dragging = false
                    if mvConn then mvConn:Disconnect() end
                    if upConn then upConn:Disconnect() end
                end
            end)
        end
    end)
    return c
end

-- create controls (left column)
local cbA_set, setterA = createCheckbox(main, "Aimbot Enabled", CONFIG.Aimbot.Enabled, UDim2.new(0, 12, 0, 56), function(v) CONFIG.Aimbot.Enabled = v end)
local cbC_set, setterC = createCheckbox(main, "Continuous Lock", CONFIG.Aimbot.ContinuousLock, UDim2.new(0, 12, 0, 96), function(v) CONFIG.Aimbot.ContinuousLock = v end)
local cbShoot_set, setterShoot = createCheckbox(main, "Aim While Shooting", CONFIG.Aimbot.AimWhileShooting, UDim2.new(0, 12, 0, 136), function(v) CONFIG.Aimbot.AimWhileShooting = v end)
local cbCam_set, setterCam = createCheckbox(main, "Aim Camera (affects movement)", CONFIG.Aimbot.AimCamera, UDim2.new(0, 12, 0, 176), function(v) CONFIG.Aimbot.AimCamera = v end)

-- right column sliders
createSlider(main, "Aimbot FOV", 20, 220, CONFIG.Aimbot.FOV, UDim2.new(0, 208, 0, 56), function(val) CONFIG.Aimbot.FOV = val end)
createSlider(main, "Max Distance", 50, 2000, CONFIG.Aimbot.MaxDistance, UDim2.new(0, 208, 0, 118), function(val) CONFIG.Aimbot.MaxDistance = val end)
createSlider(main, "Smooth Speed (%)", 1, 100, math.floor(CONFIG.Aimbot.SmoothSpeed * 100), UDim2.new(0, 208, 0, 176), function(val) CONFIG.Aimbot.SmoothSpeed = math.clamp(val / 100, 0, 1) end)

-- initialize visual checkbox states from loaded settings
-- we've already imported saved settings into CONFIG earlier
setterA(CONFIG.Aimbot.Enabled)
setterC(CONFIG.Aimbot.ContinuousLock)
setterShoot(CONFIG.Aimbot.AimWhileShooting)
setterCam(CONFIG.Aimbot.AimCamera)

-- done

end

makeUI()

-- expose fireWithAimbot to global for convenience (call this from your gun script)
_G.FireWithAimbot = fireWithAimbot

-- Optional: show a small status label on-screen
local function showStatus()
local g = PlayerGui:FindFirstChild("CloxzStatusGui")
if g then g:Destroy() end
local screen = Instance.new("ScreenGui", PlayerGui)
screen.Name = "CloxzStatusGui"
screen.ResetOnSpawn = false
local lbl = Instance.new("TextLabel", screen)
lbl.AnchorPoint = Vector2.new(0.5, 0)
lbl.Position = UDim2.new(0.5, 0, 0.02, 0)
lbl.Size = UDim2.new(0, 240, 0, 26)
lbl.BackgroundTransparency = 0.4
lbl.BackgroundColor3 = Color3.fromRGB(30, 20, 40)
lbl.TextColor3 = CONFIG.UI.TextColor
lbl.Font = Enum.Font.Gotham
lbl.TextSize = 14
lbl.Text = "Cloxz: Aimbot "..(CONFIG.Aimbot.Enabled and "ON" or "OFF").." | ESP "..(true and "ON" or "OFF")
local corner = Instance.new("UICorner", lbl); corner.CornerRadius = UDim.new(0, 6)
-- update text regularly
connections[#connections + 1] = RunService.Heartbeat:Connect(function()
if not lbl or not lbl.Parent then return end
lbl.Text = "Cloxz: Aimbot "..(CONFIG.Aimbot.Enabled and "ON" or "OFF").." | ESP ON"
end)
end
showStatus()

-- Keep running until Exit (cleanupAll called)
spawn(function()
while active do wait(1) end
cleanupAll()
end)

-- ===== INTEGRATION NOTES =====
-- 1) To make bullets actually hit, call _G.FireWithAimbot(gunOriginVector3, isHitscanBoolean, projectileSpeedNumber)
-- Example for hitscan:
-- local gunOrigin = LocalPlayer.Character.PrimaryPart.Position
-- local aimPos = _G.FireWithAimbot(gunOrigin, true)
-- if aimPos then
-- -- raycast from gunOrigin -> aimPos (server or client-side depending on your architecture)
-- -- If your server expects a direction vector: send (aimPos - gunOrigin).Unit
-- end
-- Example for projectile:
-- local bulletPart = _G.FireWithAimbot(gunOrigin, false, 400)
-- if bulletPart then
-- -- local visual bullet created; also send server RPC if required by your server architecture
-- end

-- 2) Because camera rotation can change player movement direction, the UI contains "Aim Camera" checkbox (default OFF).
-- Leave it OFF if you want your WASD movement to remain unchanged while aiming; bullets will still be redirected.

-- 3) Settings are saved to a StringValue named "CloxzSettings" under the Player (client-side). This persists
-- while the player is connected (and across respawns in the current session). For long-term persistence across sessions,
-- you'd need a server DataStore (I can add server code if you want persistent cloud saves).

-- 4) If you want the ESP toggle to be separate (on/off), I can add a checkbox that toggles building/clearing skeletons.
-- Currently skeletons are shown automatically; toggle CONFIG.Visuals.DistanceCull = 0 to disable culling. Then add this local function getSilentAimTarget()
local function getSilentAimTarget()
local best, bestDist = nil, math.huge
for _, pl in pairs(Players:GetPlayers()) do
if pl ~= LocalPlayer and pl.Character and pl.Character:FindFirstChild("HumanoidRootPart") then
local hrp = pl.Character.HumanoidRootPart
local dist = (hrp.Position - LocalPlayer.Character.PrimaryPart.Position).Magnitude
if dist < bestDist then
bestDist = dist
best = pl
end
end
end
return best
end

-- Hook your aimbot fire function:
local oldFire = _G.FireWithAimbot
_G.FireWithAimbot = function(origin, isHitscan, speed)
if Features.SilentAim then
local target = getSilentAimTarget()
if target then
local tgtPos = target.Character:FindFirstChild("Head") and target.Character.Head.Position or target.Character.HumanoidRootPart.Position
if isHitscan then
return tgtPos
else
return spawnLocalProjectile(origin, target, speed or CONFIG.Aimbot.ProjectileSpeed)
end
end
end
return oldFire(origin, isHitscan, speed)
end

-- Cleanup function
local function cleanupAll()
active = false
for _, conn in ipairs(connections) do
pcall(function() conn:Disconnect() end)
end
connections = {}
local gui = PlayerGui:FindFirstChild("CloxzMenuGui")
if gui then gui:Destroy() end
local statusGui = PlayerGui:FindFirstChild("CloxzStatusGui")
if statusGui then statusGui:Destroy() end
for _, pl in ipairs(Players:GetPlayers()) do
clearSkeleton(pl.Character)
end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions