local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local TweenService = game:GetService("TweenService") local Workspace = game:GetService("Workspace") local player = Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") local Camera = workspace.CurrentCamera -- ========================================== -- 绘制API检测 -- ========================================== local DrawingEnabled = false local Drawing = nil pcall(function() Drawing = getgenv().Drawing or Drawing if Drawing and Drawing.new then local test = Drawing.new("Square") test:Remove() DrawingEnabled = true end end) -- ========================================== -- ESP设置 -- ========================================== local Settings = { BoxESP = false, LineESP = false, SkeletonESP = false, DistanceESP = false, NameESP = false, HealthESP = false, WeaponESP = false, BoxType = "默认", LineType = "默认", SkeletonType = "默认", HealthType = "默认", LinePosition = "最下方", -- 【新增】射线位置:最下方/最上方 } local SkeletonConnections = { {"Head", "UpperTorso"}, {"UpperTorso", "LowerTorso"}, {"UpperTorso", "LeftUpperArm"}, {"LeftUpperArm", "LeftLowerArm"}, {"LeftLowerArm", "LeftHand"}, {"UpperTorso", "RightUpperArm"}, {"RightUpperArm", "RightLowerArm"}, {"RightLowerArm", "RightHand"}, {"LowerTorso", "LeftUpperLeg"}, {"LeftUpperLeg", "LeftLowerLeg"}, {"LeftLowerLeg", "LeftFoot"}, {"LowerTorso", "RightUpperLeg"}, {"RightUpperLeg", "RightLowerLeg"}, {"RightLowerLeg", "RightFoot"} } local ESPObjects = {} local LastESPUpdate = 0 local UpdateInterval = 0.066 local PlayerCountFrame = nil -- ========================================== -- 获取玩家当前武器 -- ========================================== local function GetPlayerWeapon(character) if not character then return "" end for _, child in pairs(character:GetChildren()) do if child:IsA("Tool") then return child.Name end end for _, child in pairs(player.Backpack:GetChildren()) do if child:IsA("Tool") then return child.Name end end return "" end -- ========================================== -- 世界坐标转屏幕坐标 -- ========================================== local function WorldToScreen(worldPos) local screenPos, onScreen = Camera:WorldToViewportPoint(worldPos) if not onScreen or screenPos.Z <= 0 then return Vector2.new(0, 0), false end return Vector2.new(screenPos.X, screenPos.Y), true end -- ========================================== -- 获取角色边框 -- ========================================== local function GetCharacterCorners(character) local head = character:FindFirstChild("Head") local root = character:FindFirstChild("HumanoidRootPart") if not head or not root then return nil end local distance = (root.Position - Camera.CFrame.Position).Magnitude if distance > 3000 then return nil end local cameraPos = Camera.CFrame.Position local cameraLook = Camera.CFrame.LookVector local toPlayer = (root.Position - cameraPos).Unit local dotProduct = cameraLook:Dot(toPlayer) if dotProduct < -0.2 then return nil end local headPos, headOnScreen = WorldToScreen(head.Position) local rootPos, rootOnScreen = WorldToScreen(root.Position) if not headOnScreen and not rootOnScreen then return nil end local height = math.abs(rootPos.Y - headPos.Y) * 2.2 local width = height * 0.55 local centerX = (headPos.X + rootPos.X) / 2 local centerY = (headPos.Y + rootPos.Y) / 2 return { TopLeft = Vector2.new(centerX - width / 2, centerY - height / 2), TopRight = Vector2.new(centerX + width / 2, centerY - height / 2), BottomLeft = Vector2.new(centerX - width / 2, centerY + height / 2), BottomRight = Vector2.new(centerX + width / 2, centerY + height / 2), Center = Vector2.new(centerX, centerY), Height = height, Width = width } end -- ========================================== -- 创建ESP对象 -- ========================================== local function CreateESP(targetPlayer) if not DrawingEnabled or targetPlayer == player or ESPObjects[targetPlayer] then return end local success, objects = pcall(function() local objs = { -- 方框 BoxTop = Drawing.new("Line"), BoxBottom = Drawing.new("Line"), BoxLeft = Drawing.new("Line"), BoxRight = Drawing.new("Line"), BoxTop2 = Drawing.new("Line"), BoxBottom2 = Drawing.new("Line"), BoxLeft2 = Drawing.new("Line"), BoxRight2 = Drawing.new("Line"), BoxFill = Drawing.new("Square"), CornerTL1 = Drawing.new("Line"), CornerTL2 = Drawing.new("Line"), CornerTR1 = Drawing.new("Line"), CornerTR2 = Drawing.new("Line"), CornerBL1 = Drawing.new("Line"), CornerBL2 = Drawing.new("Line"), CornerBR1 = Drawing.new("Line"), CornerBR2 = Drawing.new("Line"), -- 【修复】血量 - 使用4条弧线绘制圆圈(比Circle更可靠) HealthCircle = Drawing.new("Circle"), HealthArc1 = Drawing.new("Line"), HealthArc2 = Drawing.new("Line"), HealthArc3 = Drawing.new("Line"), HealthArc4 = Drawing.new("Line"), HealthText = Drawing.new("Text"), HealthBar = Drawing.new("Square"), HealthBarBg = Drawing.new("Square"), -- 射线 Line = Drawing.new("Line"), LineSeg1 = Drawing.new("Line"), LineSeg2 = Drawing.new("Line"), LineSeg3 = Drawing.new("Line"), LineSeg4 = Drawing.new("Line"), Line2 = Drawing.new("Line"), Line3 = Drawing.new("Line"), -- 【修复】箭头 - 创建三角形 ArrowTri = Drawing.new("Triangle"), Name = Drawing.new("Text"), Distance = Drawing.new("Text"), WeaponText = Drawing.new("Text"), Skeleton = {} } -- 初始化所有线条 for _, lineName in pairs({"BoxTop", "BoxBottom", "BoxLeft", "BoxRight", "BoxTop2", "BoxBottom2", "BoxLeft2", "BoxRight2", "CornerTL1", "CornerTL2", "CornerTR1", "CornerTR2", "CornerBL1", "CornerBL2", "CornerBR1", "CornerBR2", "Line", "Line2", "Line3", "LineSeg1", "LineSeg2", "LineSeg3", "LineSeg4"}) do if objs[lineName] then objs[lineName].Thickness = 2 objs[lineName].Color = Color3.fromRGB(0, 255, 100) objs[lineName].Visible = false objs[lineName].Transparency = 1 end end objs.BoxFill.Filled = true objs.BoxFill.Transparency = 0.3 objs.BoxFill.Color = Color3.fromRGB(0, 255, 100) objs.BoxFill.Visible = false objs.BoxFill.ZIndex = -1 objs.HealthBar.Filled = true objs.HealthBar.Transparency = 1 objs.HealthBar.Color = Color3.fromRGB(0, 255, 100) objs.HealthBar.Visible = false objs.HealthBar.ZIndex = 10 objs.HealthBarBg.Filled = true objs.HealthBarBg.Transparency = 0.5 objs.HealthBarBg.Color = Color3.fromRGB(50, 50, 50) objs.HealthBarBg.Visible = false objs.HealthBarBg.ZIndex = 9 -- 【修复】血量圆圈设置 - 使用Circle+4条弧线双重保障 objs.HealthCircle.Thickness = 3 objs.HealthCircle.Color = Color3.fromRGB(255, 255, 255) objs.HealthCircle.Filled = false objs.HealthCircle.NumSides = 64 objs.HealthCircle.Radius = 15 objs.HealthCircle.Visible = false objs.HealthCircle.Transparency = 1 objs.HealthCircle.ZIndex = 100 -- 4条弧线作为备用(右上、右下、左下、左上) for _, arcName in pairs({"HealthArc1", "HealthArc2", "HealthArc3", "HealthArc4"}) do if objs[arcName] then objs[arcName].Thickness = 3 objs[arcName].Color = Color3.fromRGB(255, 255, 255) objs[arcName].Visible = false objs[arcName].Transparency = 1 objs[arcName].ZIndex = 99 end end objs.HealthText.Size = 10 objs.HealthText.Color = Color3.fromRGB(255, 255, 255) objs.HealthText.Outline = true objs.HealthText.Center = true objs.HealthText.Visible = false objs.HealthText.Font = Drawing.Fonts.UI objs.HealthText.Transparency = 1 objs.HealthText.ZIndex = 11 -- 【修复】箭头三角形设置 objs.ArrowTri.Color = Color3.fromRGB(0, 255, 100) objs.ArrowTri.Filled = true objs.ArrowTri.Visible = false objs.ArrowTri.Transparency = 1 objs.ArrowTri.ZIndex = 5 objs.Name.Size = 11 objs.Name.Color = Color3.fromRGB(255, 255, 255) objs.Name.Outline = true objs.Name.Center = true objs.Name.Visible = false objs.Name.Font = Drawing.Fonts.UI objs.Name.Transparency = 1 objs.Distance.Size = 5.8 objs.Distance.Color = Color3.fromRGB(200, 200, 200) objs.Distance.Outline = true objs.Distance.Center = true objs.Distance.Visible = false objs.Distance.Font = Drawing.Fonts.UI objs.Distance.Transparency = 1 objs.WeaponText.Size = 10 objs.WeaponText.Color = Color3.fromRGB(255, 200, 100) objs.WeaponText.Outline = true objs.WeaponText.Center = true objs.WeaponText.Visible = false objs.WeaponText.Font = Drawing.Fonts.UI objs.WeaponText.Transparency = 1 for i = 1, #SkeletonConnections do local boneLine = Drawing.new("Line") boneLine.Thickness = 2 boneLine.Color = Color3.fromRGB(0, 255, 100) boneLine.Visible = false boneLine.Transparency = 1 table.insert(objs.Skeleton, boneLine) end return objs end) if success then ESPObjects[targetPlayer] = objects end end -- ========================================== -- 移除ESP对象 -- ========================================== local function RemoveESP(targetPlayer) if ESPObjects[targetPlayer] then pcall(function() for key, obj in pairs(ESPObjects[targetPlayer]) do if key == "Skeleton" then for _, bone in pairs(obj) do if bone and bone.Remove then bone:Remove() end end elseif obj and obj.Remove then obj:Remove() end end end) ESPObjects[targetPlayer] = nil end end -- ========================================== -- 核心ESP更新 -- ========================================== local function UpdateESP() if not DrawingEnabled then return end local currentTime = tick() if currentTime - LastESPUpdate < UpdateInterval then return end LastESPUpdate = currentTime local cameraPos = Camera.CFrame.Position local cameraLook = Camera.CFrame.LookVector local viewportSize = Camera.ViewportSize for _, targetPlayer in pairs(Players:GetPlayers()) do if targetPlayer == player then continue end local character = targetPlayer.Character if not character then RemoveESP(targetPlayer) continue end local humanoid = character:FindFirstChildOfClass("Humanoid") local head = character:FindFirstChild("Head") local root = character:FindFirstChild("HumanoidRootPart") if not humanoid or not head or not root or humanoid.Health <= 0 then RemoveESP(targetPlayer) continue end local toPlayer = (root.Position - cameraPos).Unit local dotProduct = cameraLook:Dot(toPlayer) if dotProduct < -0.3 then if ESPObjects[targetPlayer] then local objs = ESPObjects[targetPlayer] for key, obj in pairs(objs) do if key == "Skeleton" then for _, bone in pairs(obj) do bone.Visible = false end elseif obj and obj.Visible ~= nil then obj.Visible = false end end end continue end if not ESPObjects[targetPlayer] then CreateESP(targetPlayer) end local objects = ESPObjects[targetPlayer] if not objects then continue end pcall(function() local corners = GetCharacterCorners(character) if not corners then for key, obj in pairs(objects) do if key == "Skeleton" then for _, bone in pairs(obj) do bone.Visible = false end elseif obj and obj.Visible ~= nil then obj.Visible = false end end return end local distance = (root.Position - cameraPos).Magnitude local healthPercent = humanoid.Health / humanoid.MaxHealth local healthColor = Color3.fromRGB(255 * (1 - healthPercent), 255 * healthPercent, 50) -- 方框处理 if Settings.BoxESP then local tl, tr, bl, br = corners.TopLeft, corners.TopRight, corners.BottomLeft, corners.BottomRight for _, name in pairs({"BoxTop", "BoxBottom", "BoxLeft", "BoxRight", "BoxTop2", "BoxBottom2", "BoxLeft2", "BoxRight2", "CornerTL1", "CornerTL2", "CornerTR1", "CornerTR2", "CornerBL1", "CornerBL2", "CornerBR1", "CornerBR2"}) do if objects[name] then objects[name].Visible = false end end if objects.BoxFill then objects.BoxFill.Visible = false end if Settings.BoxType == "填充" then if objects.BoxFill then objects.BoxFill.Position = tl objects.BoxFill.Size = Vector2.new(corners.Width, corners.Height) objects.BoxFill.Color = healthColor objects.BoxFill.Visible = true end elseif Settings.BoxType == "双线" then local offset = 3 objects.BoxTop.Thickness = 3 objects.BoxTop.From = tl; objects.BoxTop.To = tr; objects.BoxTop.Color = healthColor; objects.BoxTop.Visible = true objects.BoxBottom.Thickness = 3 objects.BoxBottom.From = bl; objects.BoxBottom.To = br; objects.BoxBottom.Color = healthColor; objects.BoxBottom.Visible = true objects.BoxLeft.Thickness = 3 objects.BoxLeft.From = tl; objects.BoxLeft.To = bl; objects.BoxLeft.Color = healthColor; objects.BoxLeft.Visible = true objects.BoxRight.Thickness = 3 objects.BoxRight.From = tr; objects.BoxRight.To = br; objects.BoxRight.Color = healthColor; objects.BoxRight.Visible = true local innerOffset = 6 local innerTL = tl + Vector2.new(innerOffset, innerOffset) local innerTR = tr + Vector2.new(-innerOffset, innerOffset) local innerBL = bl + Vector2.new(innerOffset, -innerOffset) local innerBR = br + Vector2.new(-innerOffset, -innerOffset) objects.BoxTop2.Thickness = 1 objects.BoxTop2.From = innerTL; objects.BoxTop2.To = innerTR; objects.BoxTop2.Color = Color3.fromRGB(255,255,255); objects.BoxTop2.Visible = true objects.BoxBottom2.Thickness = 1 objects.BoxBottom2.From = innerBL; objects.BoxBottom2.To = innerBR; objects.BoxBottom2.Color = Color3.fromRGB(255,255,255); objects.BoxBottom2.Visible = true objects.BoxLeft2.Thickness = 1 objects.BoxLeft2.From = innerTL; objects.BoxLeft2.To = innerBL; objects.BoxLeft2.Color = Color3.fromRGB(255,255,255); objects.BoxLeft2.Visible = true objects.BoxRight2.Thickness = 1 objects.BoxRight2.From = innerTR; objects.BoxRight2.To = innerBR; objects.BoxRight2.Color = Color3.fromRGB(255,255,255); objects.BoxRight2.Visible = true elseif Settings.BoxType == "圆角" then local cornerLen = math.min(corners.Width, corners.Height) * 0.25 local thickness = 2 objects.CornerTL1.Thickness = thickness objects.CornerTL1.From = tl objects.CornerTL1.To = tl + Vector2.new(cornerLen, 0) objects.CornerTL1.Color = healthColor objects.CornerTL1.Visible = true objects.CornerTL2.Thickness = thickness objects.CornerTL2.From = tl objects.CornerTL2.To = tl + Vector2.new(0, cornerLen) objects.CornerTL2.Color = healthColor objects.CornerTL2.Visible = true objects.CornerTR1.Thickness = thickness objects.CornerTR1.From = tr objects.CornerTR1.To = tr + Vector2.new(-cornerLen, 0) objects.CornerTR1.Color = healthColor objects.CornerTR1.Visible = true objects.CornerTR2.Thickness = thickness objects.CornerTR2.From = tr objects.CornerTR2.To = tr + Vector2.new(0, cornerLen) objects.CornerTR2.Color = healthColor objects.CornerTR2.Visible = true objects.CornerBL1.Thickness = thickness objects.CornerBL1.From = bl objects.CornerBL1.To = bl + Vector2.new(cornerLen, 0) objects.CornerBL1.Color = healthColor objects.CornerBL1.Visible = true objects.CornerBL2.Thickness = thickness objects.CornerBL2.From = bl objects.CornerBL2.To = bl + Vector2.new(0, -cornerLen) objects.CornerBL2.Color = healthColor objects.CornerBL2.Visible = true objects.CornerBR1.Thickness = thickness objects.CornerBR1.From = br objects.CornerBR1.To = br + Vector2.new(-cornerLen, 0) objects.CornerBR1.Color = healthColor objects.CornerBR1.Visible = true objects.CornerBR2.Thickness = thickness objects.CornerBR2.From = br objects.CornerBR2.To = br + Vector2.new(0, -cornerLen) objects.CornerBR2.Color = healthColor objects.CornerBR2.Visible = true else objects.BoxTop.Thickness = 2 objects.BoxTop.From = tl; objects.BoxTop.To = tr; objects.BoxTop.Color = healthColor; objects.BoxTop.Visible = true objects.BoxBottom.Thickness = 2 objects.BoxBottom.From = bl; objects.BoxBottom.To = br; objects.BoxBottom.Color = healthColor; objects.BoxBottom.Visible = true objects.BoxLeft.Thickness = 2 objects.BoxLeft.From = tl; objects.BoxLeft.To = bl; objects.BoxLeft.Color = healthColor; objects.BoxLeft.Visible = true objects.BoxRight.Thickness = 2 objects.BoxRight.From = tr; objects.BoxRight.To = br; objects.BoxRight.Color = healthColor; objects.BoxRight.Visible = true end else for _, name in pairs({"BoxTop", "BoxBottom", "BoxLeft", "BoxRight", "BoxTop2", "BoxBottom2", "BoxLeft2", "BoxRight2", "CornerTL1", "CornerTL2", "CornerTR1", "CornerTR2", "CornerBL1", "CornerBL2", "CornerBR1", "CornerBR2"}) do if objects[name] then objects[name].Visible = false end end if objects.BoxFill then objects.BoxFill.Visible = false end end -- 【修复】血量处理 - 确保默认显示圆圈+数字 if Settings.HealthESP then -- 先全部隐藏 if objects.HealthCircle then objects.HealthCircle.Visible = false end if objects.HealthArc1 then objects.HealthArc1.Visible = false end if objects.HealthArc2 then objects.HealthArc2.Visible = false end if objects.HealthArc3 then objects.HealthArc3.Visible = false end if objects.HealthArc4 then objects.HealthArc4.Visible = false end if objects.HealthText then objects.HealthText.Visible = false end if objects.HealthBar then objects.HealthBar.Visible = false end if objects.HealthBarBg then objects.HealthBarBg.Visible = false end if Settings.HealthType == "血条" then local barWidth = 4 local barHeight = corners.Height local barX = corners.TopLeft.X - 8 local barY = corners.TopLeft.Y objects.HealthBarBg.Position = Vector2.new(barX, barY) objects.HealthBarBg.Size = Vector2.new(barWidth, barHeight) objects.HealthBarBg.Visible = true local healthHeight = barHeight * healthPercent objects.HealthBar.Position = Vector2.new(barX, barY + (barHeight - healthHeight)) objects.HealthBar.Size = Vector2.new(barWidth, healthHeight) objects.HealthBar.Color = healthColor objects.HealthBar.Visible = true elseif Settings.HealthType == "数字" then objects.HealthText.Text = tostring(math.floor(healthPercent * 100)) .. "%" objects.HealthText.Position = Vector2.new(corners.Center.X, corners.TopLeft.Y - 25) objects.HealthText.Size = 12 objects.HealthText.Color = healthColor objects.HealthText.Visible = true else -- 【修复】默认:白色圆圈边框 + 血量颜色数字 local circlePos = Vector2.new(corners.Center.X, corners.TopLeft.Y - 22) local radius = 15 -- 使用4条弧线绘制圆圈(比Drawing.Circle更可靠) local function drawCircleArc(center, r, arcObj, startAngle, endAngle) if not arcObj then return end local startRad = math.rad(startAngle) local endRad = math.rad(endAngle) local x1 = center.X + r * math.cos(startRad) local y1 = center.Y + r * math.sin(startRad) local x2 = center.X + r * math.cos(endRad) local y2 = center.Y + r * math.sin(endRad) arcObj.From = Vector2.new(x1, y1) arcObj.To = Vector2.new(x2, y2) arcObj.Color = Color3.fromRGB(255, 255, 255) arcObj.Thickness = 3 arcObj.Visible = true end -- 绘制4段弧线组成完整圆圈 if objects.HealthArc1 then drawCircleArc(circlePos, radius, objects.HealthArc1, 0, 90) end if objects.HealthArc2 then drawCircleArc(circlePos, radius, objects.HealthArc2, 90, 180) end if objects.HealthArc3 then drawCircleArc(circlePos, radius, objects.HealthArc3, 180, 270) end if objects.HealthArc4 then drawCircleArc(circlePos, radius, objects.HealthArc4, 270, 360) end -- 同时尝试使用Circle(如果支持的话) if objects.HealthCircle then objects.HealthCircle.Position = circlePos objects.HealthCircle.Radius = radius objects.HealthCircle.Color = Color3.fromRGB(255, 255, 255) objects.HealthCircle.Thickness = 3 objects.HealthCircle.Filled = false objects.HealthCircle.NumSides = 64 objects.HealthCircle.Visible = true end -- 数字显示血量,使用血量颜色 if objects.HealthText then objects.HealthText.Text = tostring(math.floor(healthPercent * 100)) objects.HealthText.Position = circlePos objects.HealthText.Size = 12 objects.HealthText.Color = healthColor objects.HealthText.Center = true objects.HealthText.Visible = true end end else if objects.HealthCircle then objects.HealthCircle.Visible = false end if objects.HealthArc1 then objects.HealthArc1.Visible = false end if objects.HealthArc2 then objects.HealthArc2.Visible = false end if objects.HealthArc3 then objects.HealthArc3.Visible = false end if objects.HealthArc4 then objects.HealthArc4.Visible = false end if objects.HealthText then objects.HealthText.Visible = false end if objects.HealthBar then objects.HealthBar.Visible = false end if objects.HealthBarBg then objects.HealthBarBg.Visible = false end end -- 【修复】射线处理 - 添加位置选择 if Settings.LineESP then -- 【新增】根据设置选择射线起点 local lineStart if Settings.LinePosition == "最上方" then lineStart = Vector2.new(viewportSize.X / 2, 0) -- 屏幕顶部中央 else lineStart = Vector2.new(viewportSize.X / 2, viewportSize.Y) -- 屏幕底部中央 end local lineEnd = corners.Center -- 隐藏所有射线元素 if objects.Line then objects.Line.Visible = false end if objects.Line2 then objects.Line2.Visible = false end if objects.Line3 then objects.Line3.Visible = false end if objects.ArrowTri then objects.ArrowTri.Visible = false end for _, seg in pairs({"LineSeg1", "LineSeg2", "LineSeg3", "LineSeg4"}) do if objects[seg] then objects[seg].Visible = false end end if Settings.LineType == "三线" then local offset = 2 local dir = (lineEnd - lineStart) local perp = Vector2.new(-dir.Y, dir.X).Unit * offset objects.Line.Thickness = 3 objects.Line.From = lineStart objects.Line.To = lineEnd objects.Line.Color = healthColor objects.Line.Visible = true objects.Line2.Thickness = 1 objects.Line2.From = lineStart + perp objects.Line2.To = lineEnd + perp objects.Line2.Color = Color3.fromRGB(255, 255, 255) objects.Line2.Visible = true objects.Line3.Thickness = 1 objects.Line3.From = lineStart - perp objects.Line3.To = lineEnd - perp objects.Line3.Color = Color3.fromRGB(255, 255, 255) objects.Line3.Visible = true elseif Settings.LineType == "箭头" then -- 【重构】使用多条线段绘制实心箭头效果 local dir = (lineEnd - lineStart).Unit local perp = Vector2.new(-dir.Y, dir.X) local arrowLen = 20 local arrowWidth = 12 -- 箭头尖端(指向玩家) local tip = lineEnd + dir * 5 -- 箭头底部中心 local base = lineEnd - dir * arrowLen -- 左右底部点 local left = base + perp * arrowWidth local right = base - perp * arrowWidth -- 绘制箭头轮廓(使用4条线) objects.Line.Thickness = 3 objects.Line.From = tip objects.Line.To = left objects.Line.Color = healthColor objects.Line.Visible = true objects.Line2.Thickness = 3 objects.Line2.From = tip objects.Line2.To = right objects.Line2.Color = healthColor objects.Line2.Visible = true objects.Line3.Thickness = 3 objects.Line3.From = left objects.Line3.To = base objects.Line3.Color = healthColor objects.Line3.Visible = true if objects.ArrowTri then objects.ArrowTri.PointA = tip objects.ArrowTri.PointB = left objects.ArrowTri.PointC = right objects.ArrowTri.Color = healthColor objects.ArrowTri.Filled = true objects.ArrowTri.Transparency = 0.8 objects.ArrowTri.Visible = true end elseif Settings.LineType == "点线" then -- 点线:用4段短线模拟虚线 local segments = 4 local totalDir = lineEnd - lineStart local segLength = totalDir.Magnitude / (segments * 2 - 1) local dir = totalDir.Unit for i = 1, segments do local segName = "LineSeg" .. i if objects[segName] then local startPos = lineStart + dir * (segLength * (i-1) * 2) local endPos = startPos + dir * segLength objects[segName].Thickness = 2 objects[segName].From = startPos objects[segName].To = endPos objects[segName].Color = healthColor objects[segName].Visible = true end end else -- 默认:单线 objects.Line.Thickness = 2 objects.Line.From = lineStart objects.Line.To = lineEnd objects.Line.Color = healthColor objects.Line.Visible = true end else if objects.Line then objects.Line.Visible = false end if objects.Line2 then objects.Line2.Visible = false end if objects.Line3 then objects.Line3.Visible = false end if objects.ArrowTri then objects.ArrowTri.Visible = false end for _, seg in pairs({"LineSeg1", "LineSeg2", "LineSeg3", "LineSeg4"}) do if objects[seg] then objects[seg].Visible = false end end end -- 名字 if Settings.NameESP then objects.Name.Text = targetPlayer.Name objects.Name.Position = Vector2.new(corners.Center.X, corners.TopLeft.Y - 35) objects.Name.Visible = true else objects.Name.Visible = false end -- 距离 if Settings.DistanceESP then objects.Distance.Text = math.floor(distance) .. "m" objects.Distance.Position = Vector2.new(corners.Center.X, corners.BottomLeft.Y + 5) objects.Distance.Visible = true else objects.Distance.Visible = false end -- 武器 if Settings.WeaponESP then local weapon = GetPlayerWeapon(character) if weapon ~= "" then objects.WeaponText.Text = weapon objects.WeaponText.Position = Vector2.new(corners.Center.X, corners.BottomLeft.Y + 30) objects.WeaponText.Visible = true else objects.WeaponText.Visible = false end else objects.WeaponText.Visible = false end -- 骨骼处理 if Settings.SkeletonESP then local boneThick = 2 local boneColor = healthColor if Settings.SkeletonType == "玩家边框" then -- 虚线效果通过快速切换透明度实现(在循环外处理) elseif Settings.SkeletonType == "发光" then boneThick = 2 boneColor = healthColor elseif Settings.SkeletonType == "彩色" then boneThick = 2 end for i, connection in ipairs(SkeletonConnections) do local boneLine = objects.Skeleton[i] if not boneLine then continue end local part1 = character:FindFirstChild(connection[1]) local part2 = character:FindFirstChild(connection[2]) if part1 and part2 then local pos1, on1 = WorldToScreen(part1.Position) local pos2, on2 = WorldToScreen(part2.Position) if on1 and on2 then -- 玩家轮廓类型:为每个身体部位绘制方框轮廓 if Settings.SkeletonType == "玩家边框" then local part = character:FindFirstChild(connection[1]) if part then local partPos, onScreen = WorldToScreen(part.Position) if onScreen then -- 根据部位大小计算方框尺寸 local partSize = Vector3.new(2, 2, 2) if part:IsA("BasePart") then partSize = part.Size end -- 计算屏幕上的方框大小 local distance = (part.Position - cameraPos).Magnitude local screenSize = math.max(10, 1000 / distance * math.max(partSize.X, partSize.Y)) local topLeft = Vector2.new(partPos.X - screenSize/2, partPos.Y - screenSize/2) local topRight = Vector2.new(partPos.X + screenSize/2, partPos.Y - screenSize/2) local bottomLeft = Vector2.new(partPos.X - screenSize/2, partPos.Y + screenSize/2) local bottomRight = Vector2.new(partPos.X + screenSize/2, partPos.Y + screenSize/2) -- 使用4条骨骼线绘制方框的四边 if i % 4 == 1 then boneLine.From = topLeft boneLine.To = topRight elseif i % 4 == 2 then boneLine.From = topRight boneLine.To = bottomRight elseif i % 4 == 3 then boneLine.From = bottomRight boneLine.To = bottomLeft else boneLine.From = bottomLeft boneLine.To = topLeft end boneLine.Thickness = 2 boneLine.Color = healthColor boneLine.Visible = true else boneLine.Visible = false end else boneLine.Visible = false end else boneLine.Visible = true boneLine.From = pos1 boneLine.To = pos2 boneLine.Thickness = boneThick end if Settings.SkeletonType == "彩色" then if connection[1] == "Head" then boneLine.Color = Color3.fromRGB(255, 255, 0) elseif string.find(connection[1], "Arm") then boneLine.Color = Color3.fromRGB(0, 150, 255) elseif string.find(connection[1], "Leg") then boneLine.Color = Color3.fromRGB(0, 255, 150) else boneLine.Color = Color3.fromRGB(255, 100, 100) end elseif Settings.SkeletonType == "发光" then -- 发光效果:霓虹灯风格 - 外层彩色光晕+内层白色核心 local pos1, on1 = WorldToScreen(part1.Position) local pos2, on2 = WorldToScreen(part2.Position) if on1 and on2 then -- 创建发光颜色(基于血量颜色的高亮版本) local glowColor = Color3.fromRGB( math.min(255, healthColor.R * 255 + 100), math.min(255, healthColor.G * 255 + 100), math.min(255, healthColor.B * 255 + 100) ) -- 第1层:最外层彩色光晕(粗,半透明) boneLine.Color = glowColor boneLine.Thickness = 10 boneLine.Transparency = 0.4 boneLine.From = pos1 boneLine.To = pos2 boneLine.Visible = true -- 第2层:中层彩色光晕(中等,半透明) if i + 1 <= #objects.Skeleton then local glow2 = objects.Skeleton[i + 1] if glow2 then glow2.Color = healthColor glow2.Thickness = 6 glow2.Transparency = 0.7 glow2.From = pos1 glow2.To = pos2 glow2.Visible = true end end -- 第3层:内层白色核心(细,不透明) if i + 2 <= #objects.Skeleton then local core = objects.Skeleton[i + 2] if core then core.Color = Color3.fromRGB(255, 255, 255) core.Thickness = 2 core.Transparency = 1 core.From = pos1 core.To = pos2 core.Visible = true end end end else boneLine.Color = boneColor end else boneLine.Visible = false end else boneLine.Visible = false end end else for _, boneLine in pairs(objects.Skeleton) do if boneLine then boneLine.Visible = false end end end end) end end Players.PlayerRemoving:Connect(function(targetPlayer) RemoveESP(targetPlayer) end) -- ========================================== -- UI代码 -- ========================================== local FontBold = Enum.Font.SourceSansBold local FontMedium = Enum.Font.SourceSansSemibold local Colors = { Background = Color3.fromRGB(245, 245, 250), Card = Color3.fromRGB(255, 255, 255), Primary = Color3.fromRGB(0, 122, 255), TextPrimary = Color3.fromRGB(30, 30, 30), TextSecondary = Color3.fromRGB(130, 130, 130), Border = Color3.fromRGB(225, 225, 230), ToggleOn = Color3.fromRGB(0, 122, 255), ToggleOff = Color3.fromRGB(200, 200, 200), } local screenGui = Instance.new("ScreenGui") screenGui.Name = "AimoxUI" screenGui.ResetOnSpawn = false screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling screenGui.Parent = playerGui -- 灵动岛悬浮球 local dynamicIsland = Instance.new("Frame") dynamicIsland.Name = "DynamicIsland" dynamicIsland.Size = UDim2.new(0, 120, 0, 36) dynamicIsland.Position = UDim2.new(0.5, -60, 0, -50) dynamicIsland.BackgroundColor3 = Colors.Card dynamicIsland.BorderSizePixel = 0 dynamicIsland.ZIndex = 100 dynamicIsland.Parent = screenGui local islandCorner = Instance.new("UICorner") islandCorner.CornerRadius = UDim.new(1, 0) islandCorner.Parent = dynamicIsland local islandStroke = Instance.new("UIStroke") islandStroke.Color = Colors.Primary islandStroke.Thickness = 2 islandStroke.Parent = dynamicIsland local islandIcon = Instance.new("Frame") islandIcon.Size = UDim2.new(0, 20, 0, 20) islandIcon.Position = UDim2.new(0, 10, 0.5, -10) islandIcon.BackgroundColor3 = Colors.Primary islandIcon.ZIndex = 101 islandIcon.Parent = dynamicIsland local iconCorner = Instance.new("UICorner") iconCorner.CornerRadius = UDim.new(1, 0) iconCorner.Parent = islandIcon local statusDot = Instance.new("Frame") statusDot.Size = UDim2.new(0, 6, 0, 6) statusDot.Position = UDim2.new(0.5, -3, 0.5, -3) statusDot.BackgroundColor3 = Color3.fromRGB(255, 255, 255) statusDot.ZIndex = 102 statusDot.Parent = islandIcon local statusDotCorner = Instance.new("UICorner") statusDotCorner.CornerRadius = UDim.new(1, 0) statusDotCorner.Parent = statusDot local islandText = Instance.new("TextLabel") islandText.Size = UDim2.new(0, 70, 0, 20) islandText.Position = UDim2.new(0, 36, 0.5, -10) islandText.BackgroundTransparency = 1 islandText.Text = "Aimox" islandText.TextColor3 = Colors.TextPrimary islandText.TextSize = 13 islandText.Font = FontBold islandText.TextXAlignment = Enum.TextXAlignment.Left islandText.ZIndex = 101 islandText.Parent = dynamicIsland -- 主窗口 local mainFrame = Instance.new("Frame") mainFrame.Name = "MainFrame" mainFrame.Size = UDim2.new(0, 480, 0, 320) mainFrame.Position = UDim2.new(0.5, -240, 1, 100) mainFrame.BackgroundColor3 = Colors.Background mainFrame.BorderSizePixel = 0 mainFrame.Visible = false mainFrame.ZIndex = 50 mainFrame.Parent = screenGui local mainFrameScale = Instance.new("UIScale") mainFrameScale.Scale = 0.8 mainFrameScale.Parent = mainFrame local mainCorner = Instance.new("UICorner") mainCorner.CornerRadius = UDim.new(0, 12) mainCorner.Parent = mainFrame local isOpen = false local isAnimating = false local function ShowMainFrame() if isAnimating then return end isAnimating = true mainFrame.Visible = true TweenService:Create(mainFrame, TweenInfo.new(0.4, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Position = UDim2.new(0.5, -240, 0.5, -160) }):Play() TweenService:Create(mainFrameScale, TweenInfo.new(0.4, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Scale = 1 }):Play() task.delay(0.4, function() isAnimating = false isOpen = true end) end local function HideMainFrame() if isAnimating then return end isAnimating = true TweenService:Create(mainFrame, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.In), { Position = UDim2.new(0.5, -240, 1, 100) }):Play() TweenService:Create(mainFrameScale, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.In), { Scale = 0.8 }):Play() task.delay(0.3, function() mainFrame.Visible = false isAnimating = false isOpen = false end) end dynamicIsland.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then if isOpen then HideMainFrame() else ShowMainFrame() end end end) -- 左侧边栏 local sidebar = Instance.new("Frame") sidebar.Name = "Sidebar" sidebar.Size = UDim2.new(0, 120, 1, -12) sidebar.Position = UDim2.new(0, 6, 0, 6) sidebar.BackgroundColor3 = Colors.Card sidebar.ZIndex = 51 sidebar.Parent = mainFrame local sidebarCorner = Instance.new("UICorner") sidebarCorner.CornerRadius = UDim.new(0, 10) sidebarCorner.Parent = sidebar local logoIcon = Instance.new("Frame") logoIcon.Size = UDim2.new(0, 32, 0, 32) logoIcon.Position = UDim2.new(0, 12, 0, 12) logoIcon.BackgroundColor3 = Colors.Primary logoIcon.ZIndex = 52 logoIcon.Parent = sidebar local logoIconCorner = Instance.new("UICorner") logoIconCorner.CornerRadius = UDim.new(0, 8) logoIconCorner.Parent = logoIcon local logoText = Instance.new("TextLabel") logoText.Size = UDim2.new(0, 60, 0, 20) logoText.Position = UDim2.new(0, 48, 0, 12) logoText.BackgroundTransparency = 1 logoText.Text = "Aimox" logoText.TextColor3 = Colors.TextPrimary logoText.TextSize = 16 logoText.Font = FontBold logoText.TextXAlignment = Enum.TextXAlignment.Left logoText.ZIndex = 52 logoText.Parent = sidebar local versionLabel = Instance.new("TextLabel") versionLabel.Size = UDim2.new(0, 28, 0, 14) versionLabel.Position = UDim2.new(0, 48, 0, 32) versionLabel.BackgroundColor3 = Colors.Primary versionLabel.Text = "V1.0" versionLabel.TextColor3 = Color3.fromRGB(255, 255, 255) versionLabel.TextSize = 9 versionLabel.Font = FontBold versionLabel.ZIndex = 52 versionLabel.Parent = sidebar local versionCorner = Instance.new("UICorner") versionCorner.CornerRadius = UDim.new(0, 3) versionCorner.Parent = versionLabel -- 菜单项 local menuItems = { {name = "公告界面"}, {name = "绘制界面", active = true}, {name = "其他绘制"}, {name = "自动瞄准"}, {name = "静默追踪"}, {name = "其他功能"}, {name = "美化界面"}, } for i, item in ipairs(menuItems) do local btn = Instance.new("TextButton") btn.Size = UDim2.new(1, -12, 0, 28) btn.Position = UDim2.new(0, 6, 0, 55 + (i-1) * 30) btn.BackgroundColor3 = item.active and Colors.Primary or Color3.fromRGB(255, 255, 255) btn.Text = "" btn.AutoButtonColor = false btn.ZIndex = 52 btn.Parent = sidebar local btnCorner = Instance.new("UICorner") btnCorner.CornerRadius = UDim.new(0, 6) btnCorner.Parent = btn local txt = Instance.new("TextLabel") txt.Size = UDim2.new(1, -12, 1, 0) txt.Position = UDim2.new(0, 10, 0, 0) txt.BackgroundTransparency = 1 txt.Text = item.name txt.TextColor3 = item.active and Color3.fromRGB(255, 255, 255) or Colors.TextPrimary txt.TextSize = 12 txt.Font = FontMedium txt.TextXAlignment = Enum.TextXAlignment.Left txt.ZIndex = 53 txt.Parent = btn end -- 用户卡片 local userCard = Instance.new("Frame") userCard.Name = "UserCard" userCard.Size = UDim2.new(1, -12, 0, 44) userCard.Position = UDim2.new(0, 6, 1, -50) userCard.BackgroundColor3 = Color3.fromRGB(248, 248, 250) userCard.ZIndex = 52 userCard.Parent = sidebar local userCardCorner = Instance.new("UICorner") userCardCorner.CornerRadius = UDim.new(0, 8) userCardCorner.Parent = userCard local avatar = Instance.new("ImageLabel") avatar.Size = UDim2.new(0, 28, 0, 28) avatar.Position = UDim2.new(0, 8, 0.5, -14) avatar.BackgroundColor3 = Colors.Primary avatar.Image = "rbxthumb://type=AvatarHeadShot&id=" .. player.UserId .. "&w=150&h=150" avatar.ZIndex = 53 avatar.Parent = userCard local avatarCorner = Instance.new("UICorner") avatarCorner.CornerRadius = UDim.new(1, 0) avatarCorner.Parent = avatar local userName = Instance.new("TextLabel") userName.Size = UDim2.new(1, -44, 0, 14) userName.Position = UDim2.new(0, 40, 0, 6) userName.BackgroundTransparency = 1 userName.Text = "记得按时吃饭" userName.TextColor3 = Colors.TextPrimary userName.TextSize = 10 userName.Font = FontBold userName.TextXAlignment = Enum.TextXAlignment.Left userName.ZIndex = 53 userName.Parent = userCard -- 中间面板 local centerPanel = Instance.new("Frame") centerPanel.Name = "CenterPanel" centerPanel.Size = UDim2.new(0, 160, 1, -12) centerPanel.Position = UDim2.new(0, 132, 0, 6) centerPanel.BackgroundColor3 = Colors.Card centerPanel.ZIndex = 51 centerPanel.Parent = mainFrame local centerCorner = Instance.new("UICorner") centerCorner.CornerRadius = UDim.new(0, 10) centerCorner.Parent = centerPanel local centerTitle = Instance.new("TextLabel") centerTitle.Size = UDim2.new(1, -12, 0, 28) centerTitle.Position = UDim2.new(0, 10, 0, 8) centerTitle.BackgroundTransparency = 1 centerTitle.Text = "绘制界面" centerTitle.TextColor3 = Colors.TextPrimary centerTitle.TextSize = 14 centerTitle.Font = FontBold centerTitle.TextXAlignment = Enum.TextXAlignment.Left centerTitle.ZIndex = 52 centerTitle.Parent = centerPanel local centerScroll = Instance.new("ScrollingFrame") centerScroll.Name = "CenterScroll" centerScroll.Size = UDim2.new(1, -10, 1, -40) centerScroll.Position = UDim2.new(0, 6, 0, 36) centerScroll.BackgroundTransparency = 1 centerScroll.BorderSizePixel = 0 centerScroll.ScrollBarThickness = 3 centerScroll.CanvasSize = UDim2.new(0, 0, 0, 520) centerScroll.ZIndex = 52 centerScroll.Parent = centerPanel -- 【修改】开关列表 - 删除绘制背敌 local toggles = { {text = "绘制方框", key = "BoxESP"}, {text = "绘制射线", key = "LineESP"}, {text = "绘制距离", key = "DistanceESP"}, {text = "绘制骨骼", key = "SkeletonESP"}, {text = "绘制血量", key = "HealthESP"}, {text = "绘制名字", key = "NameESP"}, {text = "绘制武器", key = "WeaponESP"}, } for i, toggleData in ipairs(toggles) do local row = Instance.new("Frame") row.Name = "ToggleRow_" .. i row.Size = UDim2.new(1, 0, 0, 34) row.Position = UDim2.new(0, 0, 0, (i-1) * 36) row.BackgroundTransparency = 1 row.ZIndex = 53 row.Parent = centerScroll local label = Instance.new("TextLabel") label.Size = UDim2.new(1, -50, 1, 0) label.Position = UDim2.new(0, 10, 0, 0) label.BackgroundTransparency = 1 label.Text = toggleData.text label.TextColor3 = Colors.TextPrimary label.TextSize = 12 label.Font = FontMedium label.TextXAlignment = Enum.TextXAlignment.Left label.ZIndex = 54 label.Parent = row local toggleBg = Instance.new("TextButton") toggleBg.Size = UDim2.new(0, 38, 0, 20) toggleBg.Position = UDim2.new(1, -44, 0.5, -10) toggleBg.BackgroundColor3 = Settings[toggleData.key] and Colors.ToggleOn or Colors.ToggleOff toggleBg.Text = "" toggleBg.AutoButtonColor = false toggleBg.ZIndex = 54 toggleBg.Parent = row local toggleCorner = Instance.new("UICorner") toggleCorner.CornerRadius = UDim.new(1, 0) toggleCorner.Parent = toggleBg local dot = Instance.new("Frame") dot.Size = UDim2.new(0, 16, 0, 16) dot.Position = Settings[toggleData.key] and UDim2.new(1, -18, 0, 2) or UDim2.new(0, 2, 0, 2) dot.BackgroundColor3 = Color3.fromRGB(255, 255, 255) dot.ZIndex = 55 dot.Parent = toggleBg local dotCorner = Instance.new("UICorner") dotCorner.CornerRadius = UDim.new(1, 0) dotCorner.Parent = dot toggleBg.MouseButton1Click:Connect(function() local newState = not Settings[toggleData.key] Settings[toggleData.key] = newState if newState then toggleBg.BackgroundColor3 = Colors.ToggleOn dot.Position = UDim2.new(1, -18, 0, 2) else toggleBg.BackgroundColor3 = Colors.ToggleOff dot.Position = UDim2.new(0, 2, 0, 2) end if toggleData.key == "PlayerCountESP" and PlayerCountFrame then PlayerCountFrame.Visible = newState if newState then UpdatePlayerCount() end end end) end -- 右侧面板 local rightPanel = Instance.new("Frame") rightPanel.Name = "RightPanel" rightPanel.Size = UDim2.new(0, 180, 1, -12) rightPanel.Position = UDim2.new(0, 298, 0, 6) rightPanel.BackgroundColor3 = Colors.Card rightPanel.ZIndex = 51 rightPanel.Parent = mainFrame local rightCorner = Instance.new("UICorner") rightCorner.CornerRadius = UDim.new(0, 10) rightCorner.Parent = rightPanel local header = Instance.new("Frame") header.Name = "Header" header.Size = UDim2.new(1, -16, 0, 32) header.Position = UDim2.new(0, 10, 0, 6) header.BackgroundTransparency = 1 header.ZIndex = 52 header.Parent = rightPanel local backBtn = Instance.new("TextButton") backBtn.Size = UDim2.new(0, 24, 0, 24) backBtn.Position = UDim2.new(0, 0, 0, 4) backBtn.BackgroundTransparency = 1 backBtn.Text = "<" backBtn.TextColor3 = Colors.TextSecondary backBtn.TextSize = 16 backBtn.Font = FontBold backBtn.ZIndex = 53 backBtn.Parent = header backBtn.MouseButton1Click:Connect(function() HideMainFrame() end) local rightTitle = Instance.new("TextLabel") rightTitle.Size = UDim2.new(1, -28, 1, 0) rightTitle.Position = UDim2.new(0, 22, 0, 0) rightTitle.BackgroundTransparency = 1 rightTitle.Text = "样式设置" rightTitle.TextColor3 = Colors.TextPrimary rightTitle.TextSize = 13 rightTitle.Font = FontBold rightTitle.TextXAlignment = Enum.TextXAlignment.Left rightTitle.ZIndex = 53 rightTitle.Parent = header local divider = Instance.new("Frame") divider.Size = UDim2.new(1, -12, 0, 1) divider.Position = UDim2.new(0, 8, 0, 38) divider.BackgroundColor3 = Colors.Border divider.BorderSizePixel = 0 divider.ZIndex = 52 divider.Parent = rightPanel local rightScroll = Instance.new("ScrollingFrame") rightScroll.Name = "RightScroll" rightScroll.Size = UDim2.new(1, -16, 1, -50) rightScroll.Position = UDim2.new(0, 10, 0, 44) rightScroll.BackgroundTransparency = 1 rightScroll.BorderSizePixel = 0 rightScroll.ScrollBarThickness = 3 rightScroll.CanvasSize = UDim2.new(0, 0, 0, 460) rightScroll.ZIndex = 52 rightScroll.Parent = rightPanel -- 类型选择器 local function CreateTypeSelector(titleText, settingKey, options, index) local container = Instance.new("Frame") container.Name = "TypeSelector_" .. settingKey container.Size = UDim2.new(1, 0, 0, 70) container.Position = UDim2.new(0, 0, 0, index * 76) container.BackgroundTransparency = 1 container.ZIndex = 60 container.Parent = rightScroll local title = Instance.new("TextLabel") title.Size = UDim2.new(1, 0, 0, 16) title.BackgroundTransparency = 1 title.Text = titleText title.TextColor3 = Colors.TextPrimary title.TextSize = 12 title.Font = FontMedium title.TextXAlignment = Enum.TextXAlignment.Left title.ZIndex = 61 title.Parent = container local dropdownBtn = Instance.new("TextButton") dropdownBtn.Size = UDim2.new(1, 0, 0, 28) dropdownBtn.Position = UDim2.new(0, 0, 0, 22) dropdownBtn.BackgroundColor3 = Color3.fromRGB(235, 235, 240) dropdownBtn.Text = " " .. Settings[settingKey] .. " ▼" dropdownBtn.TextColor3 = Colors.TextPrimary dropdownBtn.TextSize = 11 dropdownBtn.Font = FontMedium dropdownBtn.TextXAlignment = Enum.TextXAlignment.Left dropdownBtn.ZIndex = 61 dropdownBtn.Parent = container local dropdownCorner = Instance.new("UICorner") dropdownCorner.CornerRadius = UDim.new(0, 6) dropdownCorner.Parent = dropdownBtn local dropdownGui = Instance.new("ScreenGui") dropdownGui.Name = "Dropdown_" .. settingKey dropdownGui.ResetOnSpawn = false dropdownGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling dropdownGui.Enabled = false dropdownGui.Parent = playerGui local optionsFrame = Instance.new("Frame") optionsFrame.Size = UDim2.new(0, 160, 0, #options * 26) optionsFrame.BackgroundColor3 = Colors.Card optionsFrame.BorderSizePixel = 0 optionsFrame.ZIndex = 100 optionsFrame.Parent = dropdownGui local optionsCorner = Instance.new("UICorner") optionsCorner.CornerRadius = UDim.new(0, 6) optionsCorner.Parent = optionsFrame local optionsStroke = Instance.new("UIStroke") optionsStroke.Color = Colors.Border optionsStroke.Thickness = 1 optionsStroke.Parent = optionsFrame for i, option in ipairs(options) do local optionBtn = Instance.new("TextButton") optionBtn.Size = UDim2.new(1, 0, 0, 26) optionBtn.Position = UDim2.new(0, 0, 0, (i-1) * 26) optionBtn.BackgroundColor3 = (option == Settings[settingKey]) and Colors.Primary or Colors.Card optionBtn.Text = " " .. option optionBtn.TextColor3 = (option == Settings[settingKey]) and Color3.fromRGB(255,255,255) or Colors.TextPrimary optionBtn.TextSize = 11 optionBtn.Font = FontMedium optionBtn.TextXAlignment = Enum.TextXAlignment.Left optionBtn.ZIndex = 101 optionBtn.Parent = optionsFrame optionBtn.MouseButton1Click:Connect(function() Settings[settingKey] = option dropdownBtn.Text = " " .. option .. " ▼" dropdownGui.Enabled = false for _, child in pairs(optionsFrame:GetChildren()) do if child:IsA("TextButton") then local optText = string.sub(child.Text, 3) if optText == option then child.BackgroundColor3 = Colors.Primary child.TextColor3 = Color3.fromRGB(255,255,255) else child.BackgroundColor3 = Colors.Card child.TextColor3 = Colors.TextPrimary end end end end) end dropdownBtn.MouseButton1Click:Connect(function() local isOpen = dropdownGui.Enabled for _, gui in pairs(playerGui:GetChildren()) do if gui:IsA("ScreenGui") and string.find(gui.Name, "Dropdown_") then gui.Enabled = false end end if not isOpen then local absPos = dropdownBtn.AbsolutePosition local absSize = dropdownBtn.AbsoluteSize optionsFrame.Position = UDim2.new(0, absPos.X, 0, absPos.Y + absSize.Y + 2) dropdownGui.Enabled = true dropdownBtn.Text = " " .. Settings[settingKey] .. " ▲" else dropdownBtn.Text = " " .. Settings[settingKey] .. " ▼" end end) UserInputService.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then local mousePos = UserInputService:GetMouseLocation() local btnPos = dropdownBtn.AbsolutePosition local btnSize = dropdownBtn.AbsoluteSize local framePos = optionsFrame.AbsolutePosition local frameSize = optionsFrame.AbsoluteSize local inBtn = mousePos.X >= btnPos.X and mousePos.X <= btnPos.X + btnSize.X and mousePos.Y >= btnPos.Y and mousePos.Y <= btnPos.Y + btnSize.Y local inFrame = mousePos.X >= framePos.X and mousePos.X <= framePos.X + frameSize.X and mousePos.Y >= framePos.Y and mousePos.Y <= framePos.Y + frameSize.Y if not inBtn and not inFrame then dropdownGui.Enabled = false dropdownBtn.Text = " " .. Settings[settingKey] .. " ▼" end end end) end CreateTypeSelector("方框类型", "BoxType", {"默认", "填充", "圆角", "双线"}, 0) CreateTypeSelector("射线类型", "LineType", {"默认", "三线", "箭头", "点线"}, 1) CreateTypeSelector("骨骼类型", "SkeletonType", {"默认", "玩家边框", "发光", "彩色"}, 2) CreateTypeSelector("血量类型", "HealthType", {"默认", "血条", "数字"}, 3) CreateTypeSelector("射线位置", "LinePosition", {"最下方", "最上方"}, 4) -- 【新增】 -- 绘制循环 RunService.Heartbeat:Connect(function() local needESP = Settings.BoxESP or Settings.LineESP or Settings.SkeletonESP or Settings.NameESP or Settings.DistanceESP or Settings.HealthESP or Settings.WarnESP or Settings.WeaponESP if needESP and DrawingEnabled then UpdateESP() elseif not needESP then for targetPlayer, _ in pairs(ESPObjects) do RemoveESP(targetPlayer) end end end) print("Aimox UI 修改版加载完成!")