Advertisement
RBLXTUTS

fhudhukjgx

Jun 21st, 2025
423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 23.21 KB | None | 0 0
  1. -- Luna Scripts Legit Aimbot – Purple Edition (Full Fixed Keybinds + ESP + Scroll GUI)
  2. if not game:IsLoaded() then game.Loaded:Wait() end
  3.  
  4. -- Services & Config
  5. local UIS = game:GetService("UserInputService")
  6. local RS = game:GetService("RunService")
  7. local PL = game:GetService("Players").LocalPlayer
  8. local Cam = workspace.CurrentCamera
  9. local HttpService = game:GetService("HttpService")
  10. local CONFIG_FILE = "LunaAimbotConfig.json"
  11.  
  12. -- Settings defaults
  13. local Settings = {
  14.     FOV = 150,
  15.     Speed = 0.25,
  16.     Prediction = 0.14,
  17.     FOVVisible = true,
  18.     VisibleCheck = true,
  19.     AntiDetection = false,
  20.     TargetBone = "Head",
  21.     AimbotEnabled = false,
  22.     KeybindAim = "MouseButton2",
  23.     KeybindToggleUI = "RightControl",
  24.     ESPEnabled = false,
  25.     ESPBoxes = false,
  26.     ESPNames = false,
  27.     ESPHealth = false
  28. }
  29.  
  30. -- Load / Save config
  31. local function saveConfig()
  32.     if writefile then writefile(CONFIG_FILE, HttpService:JSONEncode(Settings)) end
  33. end
  34. local function loadConfig()
  35.     if isfile and readfile and isfile(CONFIG_FILE) then
  36.         local ok, t = pcall(function()
  37.             return HttpService:JSONDecode(readfile(CONFIG_FILE))
  38.         end)
  39.         if ok and type(t) == "table" then
  40.             for k,v in pairs(t) do
  41.                 if Settings[k] ~= nil then Settings[k] = t[k] end
  42.             end
  43.         end
  44.     end
  45. end
  46. loadConfig()
  47.  
  48. -- FOV circle
  49. local FOVCircle = Drawing.new("Circle")
  50. FOVCircle.Thickness = 1
  51. FOVCircle.Radius = Settings.FOV
  52. FOVCircle.Color = Color3.fromRGB(170, 0, 255)
  53. FOVCircle.Filled = false
  54. FOVCircle.Visible = Settings.FOVVisible
  55.  
  56. local aiming = false
  57. local TOPBAR = 36
  58.  
  59. -- Utility functions
  60. local function isEnemy(p)
  61.     local c = p.Character
  62.     return p ~= PL and c and c:FindFirstChild("Humanoid") and c.Humanoid.Health > 0
  63. end
  64.  
  65. local function getBone(p)
  66.     local c = p.Character
  67.     if not c then return end
  68.     if Settings.TargetBone == "Head" then
  69.         return c:FindFirstChild("Head")
  70.     elseif Settings.TargetBone == "Torso" then
  71.         return c:FindFirstChild("UpperTorso") or c:FindFirstChild("Torso")
  72.     else -- Realistic
  73.         return (math.random() < 0.7 and c:FindFirstChild("Head")) or c:FindFirstChild("UpperTorso") or c:FindFirstChild("Torso")
  74.     end
  75. end
  76.  
  77. local function partVisible(part)
  78.     local rp = RaycastParams.new()
  79.     rp.FilterDescendantsInstances = {PL.Character}
  80.     rp.FilterType = Enum.RaycastFilterType.Blacklist
  81.     local res = workspace:Raycast(Cam.CFrame.Position, (part.Position - Cam.CFrame.Position).Unit * 1000, rp)
  82.     return res and res.Instance and res.Instance:IsDescendantOf(part.Parent)
  83. end
  84.  
  85. local function getClosest()
  86.     local m = UIS:GetMouseLocation()
  87.     local best, bestDist = nil, Settings.FOV
  88.     for _,p in pairs(game:GetService("Players"):GetPlayers()) do
  89.         if isEnemy(p) then
  90.             local b = getBone(p)
  91.             if b then
  92.                 local sp, ons = Cam:WorldToViewportPoint(b.Position)
  93.                 if ons then
  94.                     local d = (Vector2.new(sp.X, sp.Y) - Vector2.new(m.X, m.Y - TOPBAR)).Magnitude
  95.                     if d < bestDist then
  96.                         if not Settings.VisibleCheck or partVisible(b) then
  97.                             bestDist = d
  98.                             best = b
  99.                         end
  100.                     end
  101.                 end
  102.             end
  103.         end
  104.     end
  105.     return best
  106. end
  107.  
  108. -- Helper: input matches keybind string (mouse or keyboard)
  109. local function inputMatchesKey(input, keybindStr)
  110.     if not input or not keybindStr then return false end
  111.     if keybindStr:match("^MouseButton%d$") then
  112.         return input.UserInputType.Name == keybindStr
  113.     else
  114.         return input.KeyCode and input.KeyCode.Name == keybindStr
  115.     end
  116. end
  117.  
  118. -- Aimbot movement
  119. RS.RenderStepped:Connect(function()
  120.     local m = UIS:GetMouseLocation()
  121.     FOVCircle.Position = Vector2.new(m.X, m.Y - TOPBAR)
  122.     FOVCircle.Radius = Settings.FOV
  123.     FOVCircle.Visible = Settings.FOVVisible and Settings.AimbotEnabled
  124.  
  125.     if aiming and Settings.AimbotEnabled then
  126.         local b = getClosest()
  127.         if b then
  128.             local pred = b.Position + b.Velocity * Settings.Prediction
  129.             local sp, ons = Cam:WorldToViewportPoint(pred)
  130.             if ons and sp.Z > 0 then
  131.                 local dx = sp.X - m.X
  132.                 local dy = sp.Y - (m.Y - TOPBAR)
  133.                 if Settings.AntiDetection then
  134.                     dx += math.random(-3,3)
  135.                     dy += math.random(-3,3)
  136.                 end
  137.                 mousemoverel(dx * Settings.Speed, dy * Settings.Speed)
  138.             end
  139.         end
  140.     end
  141. end)
  142.  
  143. -- GUI Setup
  144. local gui = Instance.new("ScreenGui", game.CoreGui)
  145. gui.Name = "LunaGui"
  146. gui.ResetOnSpawn = false
  147. gui.Enabled = true
  148.  
  149. local bg = Instance.new("Frame", gui)
  150. bg.Size = UDim2.new(0, 350, 0, 500)
  151. bg.Position = UDim2.new(0, 50, 0, 50)
  152. bg.BackgroundColor3 = Color3.fromRGB(25, 0, 50)
  153. bg.BorderSizePixel = 0
  154. bg.ClipsDescendants = true
  155.  
  156. local bar = Instance.new("Frame", bg)
  157. bar.Size = UDim2.new(1,0,0,TOPBAR)
  158. bar.BackgroundColor3 = Color3.fromRGB(120, 0, 255)
  159. bar.Active = true
  160. bar.Selectable = true
  161.  
  162. -- Dragging logic for whole bg via bar
  163. local dragging, dragStart, startPos
  164. bar.InputBegan:Connect(function(i)
  165.     if i.UserInputType == Enum.UserInputType.MouseButton1 then
  166.         dragging = true
  167.         dragStart = i.Position
  168.         startPos = bg.Position
  169.         i.Changed:Connect(function()
  170.             if i.UserInputState == Enum.UserInputState.End then
  171.                 dragging = false
  172.             end
  173.         end)
  174.     end
  175. end)
  176. bar.InputChanged:Connect(function(i)
  177.     if dragging and i.UserInputType == Enum.UserInputType.MouseMovement then
  178.         local delta = i.Position - dragStart
  179.         bg.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X,
  180.                                 startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  181.     end
  182. end)
  183.  
  184. -- Title
  185. local title = Instance.new("TextLabel", bar)
  186. title.Size = UDim2.new(1, -60, 1, 0)
  187. title.Position = UDim2.new(0, 12, 0, 0)
  188. title.BackgroundTransparency = 1
  189. title.Font = Enum.Font.GothamSemibold
  190. title.Text = "LUNA SCRIPTS"
  191. title.TextSize = 20
  192. title.TextColor3 = Color3.new(1, 1, 1)
  193. title.TextXAlignment = Enum.TextXAlignment.Left
  194. title.TextYAlignment = Enum.TextYAlignment.Center
  195.  
  196. -- Minimize button
  197. local minBtn = Instance.new("TextButton", bar)
  198. minBtn.Size = UDim2.new(0, 48, 0, TOPBAR - 8)
  199. minBtn.Position = UDim2.new(1, -52, 0, 4)
  200. minBtn.BackgroundColor3 = Color3.fromRGB(90, 0, 180)
  201. minBtn.Font = Enum.Font.GothamBold
  202. minBtn.TextSize = 20
  203. minBtn.Text = "─"
  204. minBtn.TextColor3 = Color3.new(1,1,1)
  205. minBtn.AutoButtonColor = false
  206. minBtn.MouseButton1Click:Connect(function()
  207.     local hidden = bg.Size.Y.Offset > TOPBAR
  208.     bg.Size = hidden and UDim2.new(0,350,0,TOPBAR) or UDim2.new(0,350,0,500)
  209.     minBtn.Text = hidden and "▣" or "─"
  210. end)
  211.  
  212. -- Tabs frame
  213. local tabs = Instance.new("Frame", bg)
  214. tabs.Size = UDim2.new(1, 0, 0, TOPBAR)
  215. tabs.Position = UDim2.new(0, 0, 0, TOPBAR)
  216. tabs.BackgroundColor3 = Color3.fromRGB(40, 0, 80)
  217.  
  218. -- Scrolling frame for pages
  219. local pages = Instance.new("ScrollingFrame", bg)
  220. pages.Size = UDim2.new(1, 0, 1, -TOPBAR*2)
  221. pages.Position = UDim2.new(0, 0, 0, TOPBAR*2)
  222. pages.CanvasSize = UDim2.new(0, 0, 2, 0)
  223. pages.ScrollBarThickness = 6
  224. pages.BackgroundTransparency = 1
  225. pages.VerticalScrollBarInset = Enum.ScrollBarInset.Always
  226.  
  227. -- Tab buttons creator
  228. local function createTab(name)
  229.     local btn = Instance.new("TextButton", tabs)
  230.     btn.Size = UDim2.new(0, 80, 1, 0)
  231.     btn.Text = name
  232.     btn.Font = Enum.Font.GothamBold
  233.     btn.TextSize = 18
  234.     btn.TextColor3 = Color3.fromRGB(220, 220, 220)
  235.     btn.BackgroundColor3 = Color3.fromRGB(70, 0, 130)
  236.     btn.AutoButtonColor = false
  237.     btn.BorderSizePixel = 0
  238.     btn.Name = name .. "Tab"
  239.  
  240.     btn.MouseEnter:Connect(function() btn.BackgroundColor3 = Color3.fromRGB(120, 0, 255) end)
  241.     btn.MouseLeave:Connect(function()
  242.         if not btn:GetAttribute("Selected") then
  243.             btn.BackgroundColor3 = Color3.fromRGB(70, 0, 130)
  244.         end
  245.     end)
  246.  
  247.     return btn
  248. end
  249.  
  250. -- Pages creator
  251. local function createPage()
  252.     local frame = Instance.new("Frame", pages)
  253.     frame.Size = UDim2.new(1, 0, 0, 440)
  254.     frame.BackgroundTransparency = 1
  255.     frame.Visible = false
  256.     return frame
  257. end
  258.  
  259. -- Create Tabs and Pages
  260. local aimTabBtn = createTab("Aim")
  261. local espTabBtn = createTab("ESP")
  262. local miscTabBtn = createTab("Misc")
  263.  
  264. aimTabBtn.Position = UDim2.new(0, 0, 0, 0)
  265. espTabBtn.Position = UDim2.new(0, 80, 0, 0)
  266. miscTabBtn.Position = UDim2.new(0, 160, 0, 0)
  267.  
  268. local aimPage = createPage()
  269. local espPage = createPage()
  270. local miscPage = createPage()
  271. aimPage.Position = UDim2.new(0, 0, 0, 0)
  272. espPage.Position = UDim2.new(0, 0, 0, 440)
  273. miscPage.Position = UDim2.new(0, 0, 0, 880)
  274.  
  275. -- Tab switch logic
  276. local function selectTab(selectedBtn, selectedPage)
  277.     for _, btn in pairs(tabs:GetChildren()) do
  278.         if btn:IsA("TextButton") then
  279.             btn.BackgroundColor3 = Color3.fromRGB(70, 0, 130)
  280.             btn:SetAttribute("Selected", false)
  281.         end
  282.     end
  283.     for _, page in pairs(pages:GetChildren()) do
  284.         if page:IsA("Frame") then
  285.             page.Visible = false
  286.         end
  287.     end
  288.     selectedBtn.BackgroundColor3 = Color3.fromRGB(120, 0, 255)
  289.     selectedBtn:SetAttribute("Selected", true)
  290.     selectedPage.Visible = true
  291.     pages.CanvasPosition = Vector2.new(0, selectedPage.Position.Y.Offset)
  292. end
  293.  
  294. selectTab(aimTabBtn, aimPage)
  295.  
  296. aimTabBtn.MouseButton1Click:Connect(function()
  297.     selectTab(aimTabBtn, aimPage)
  298. end)
  299. espTabBtn.MouseButton1Click:Connect(function()
  300.     selectTab(espTabBtn, espPage)
  301. end)
  302. miscTabBtn.MouseButton1Click:Connect(function()
  303.     selectTab(miscTabBtn, miscPage)
  304. end)
  305.  
  306. -- Slider creator for aim page
  307. local ypos = 10
  308. local function makeSlider(parent, labelTxt, min, max, settingKey)
  309.     local lbl = Instance.new("TextLabel", parent)
  310.     lbl.Size = UDim2.new(0, 300, 0, 22)
  311.     lbl.Position = UDim2.new(0, 20, 0, ypos)
  312.     lbl.BackgroundTransparency = 1
  313.     lbl.Font = Enum.Font.Gotham
  314.     lbl.TextSize = 16
  315.     lbl.TextColor3 = Color3.fromRGB(220, 220, 220)
  316.     lbl.Text = labelTxt .. ": " .. string.format("%.3f", Settings[settingKey])
  317.  
  318.     local barBg = Instance.new("Frame", parent)
  319.     barBg.Size = UDim2.new(0, 300, 0, 16)
  320.     barBg.Position = UDim2.new(0, 20, 0, ypos + 24)
  321.     barBg.BackgroundColor3 = Color3.fromRGB(50, 30, 70)
  322.     barBg.BorderSizePixel = 0
  323.     barBg.ClipsDescendants = true
  324.     Instance.new("UICorner", barBg).CornerRadius = UDim.new(0, 6)
  325.  
  326.     local fill = Instance.new("Frame", barBg)
  327.     fill.BackgroundColor3 = Color3.fromRGB(170, 0, 255)
  328.     fill.Size = UDim2.new((Settings[settingKey] - min) / (max - min), 0, 1, 0)
  329.     Instance.new("UICorner", fill).CornerRadius = UDim.new(0,6)
  330.  
  331.     local draggingS = false
  332.     barBg.InputBegan:Connect(function(i) if i.UserInputType == Enum.UserInputType.MouseButton1 then draggingS = true end end)
  333.     barBg.InputEnded:Connect(function(i) if i.UserInputType == Enum.UserInputType.MouseButton1 then draggingS = false saveConfig() end end)
  334.     UIS.InputChanged:Connect(function(i)
  335.         if draggingS and i.UserInputType == Enum.UserInputType.MouseMovement then
  336.             local pct = math.clamp((i.Position.X - barBg.AbsolutePosition.X) / barBg.AbsoluteSize.X, 0, 1)
  337.             fill.Size = UDim2.new(pct,0,1,0)
  338.             Settings[settingKey] = min + (max - min) * pct
  339.             lbl.Text = labelTxt .. ": " .. string.format("%.3f", Settings[settingKey])
  340.         end
  341.     end)
  342.  
  343.     ypos += 60
  344. end
  345.  
  346. makeSlider(aimPage, "FOV Radius", 50, 400, "FOV")
  347. makeSlider(aimPage, "Aim Speed", 0.05, 1, "Speed")
  348. makeSlider(aimPage, "Prediction", 0, 0.4, "Prediction")
  349.  
  350. -- Toggle creator (generic)
  351. local function makeToggle(parent, onTxt, offTxt, key, posY)
  352.     local btn = Instance.new("TextButton", parent)
  353.     btn.Size = UDim2.new(0, 300, 0, 38)
  354.     btn.Position = UDim2.new(0, 20, 0, posY)
  355.     btn.BackgroundColor3 = Color3.fromRGB(170, 0, 255)
  356.     btn.Font = Enum.Font.GothamSemibold
  357.     btn.TextSize = 18
  358.     btn.AutoButtonColor = false
  359.     btn.TextColor3 = Color3.new(1,1,1)
  360.     btn.Text = Settings[key] and onTxt or offTxt
  361.     btn.MouseEnter:Connect(function() btn.BackgroundColor3 = Color3.fromRGB(200, 50, 255) end)
  362.     btn.MouseLeave:Connect(function() btn.BackgroundColor3 = Color3.fromRGB(170, 0, 255) end)
  363.     btn.MouseButton1Click:Connect(function()
  364.         Settings[key] = not Settings[key]
  365.         btn.Text = Settings[key] and onTxt or offTxt
  366.         saveConfig()
  367.     end)
  368. end
  369.  
  370. -- Aim toggles
  371. makeToggle(aimPage, "Aimbot: ON", "Aimbot: OFF", "AimbotEnabled", ypos)
  372. ypos += 50
  373. makeToggle(aimPage, "FOV Circle: ON", "FOV Circle: OFF", "FOVVisible", ypos)
  374. ypos += 50
  375. makeToggle(aimPage, "Vis Check: ON", "Vis Check: OFF", "VisibleCheck", ypos)
  376. ypos += 50
  377. makeToggle(aimPage, "Anti-Detect: ON", "Anti-Detect: OFF", "AntiDetection", ypos)
  378. ypos += 50
  379.  
  380. -- Target Bone selector
  381. local boneLbl = Instance.new("TextLabel", aimPage)
  382. boneLbl.Size = UDim2.new(0, 300, 0, 22)
  383. boneLbl.Position = UDim2.new(0, 20, 0, ypos)
  384. boneLbl.BackgroundTransparency = 1
  385. boneLbl.Font = Enum.Font.Gotham
  386. boneLbl.TextSize = 16
  387. boneLbl.TextColor3 = Color3.fromRGB(220,220,220)
  388. boneLbl.Text = "Target Bone: " .. Settings.TargetBone
  389. ypos += 28
  390.  
  391. local boneBtn = Instance.new("TextButton", aimPage)
  392. boneBtn.Size = UDim2.new(0, 300, 0, 38)
  393. boneBtn.Position = UDim2.new(0, 20, 0, ypos)
  394. boneBtn.BackgroundColor3 = Color3.fromRGB(170,0,255)
  395. boneBtn.Font = Enum.Font.GothamSemibold
  396. boneBtn.TextSize = 18
  397. boneBtn.TextColor3 = Color3.new(1,1,1)
  398. boneBtn.AutoButtonColor = false
  399. boneBtn.Text = Settings.TargetBone
  400. boneBtn.MouseEnter:Connect(function() boneBtn.BackgroundColor3 = Color3.fromRGB(200,50,255) end)
  401. boneBtn.MouseLeave:Connect(function() boneBtn.BackgroundColor3 = Color3.fromRGB(170,0,255) end)
  402. boneBtn.MouseButton1Click:Connect(function()
  403.     local options = {"Head", "Torso", "Realistic"}
  404.     local i = table.find(options, Settings.TargetBone) or 1
  405.     i = i % #options + 1
  406.     Settings.TargetBone = options[i]
  407.     boneLbl.Text = "Target Bone: " .. Settings.TargetBone
  408.     boneBtn.Text = Settings.TargetBone
  409.     saveConfig()
  410. end)
  411. ypos += 50
  412.  
  413. -- Aim keybind changer
  414. local aimKeyLbl = Instance.new("TextLabel", aimPage)
  415. aimKeyLbl.Size = UDim2.new(0, 300, 0, 22)
  416. aimKeyLbl.Position = UDim2.new(0, 20, 0, ypos)
  417. aimKeyLbl.BackgroundTransparency = 1
  418. aimKeyLbl.Font = Enum.Font.Gotham
  419. aimKeyLbl.TextSize = 16
  420. aimKeyLbl.TextColor3 = Color3.fromRGB(220,220,220)
  421. aimKeyLbl.Text = "Aim Keybind: " .. Settings.KeybindAim
  422. ypos += 28
  423.  
  424. local aimKeyBtn = Instance.new("TextButton", aimPage)
  425. aimKeyBtn.Size = UDim2.new(0, 300, 0, 38)
  426. aimKeyBtn.Position = UDim2.new(0, 20, 0, ypos)
  427. aimKeyBtn.BackgroundColor3 = Color3.fromRGB(170,0,255)
  428. aimKeyBtn.Font = Enum.Font.GothamSemibold
  429. aimKeyBtn.TextSize = 18
  430. aimKeyBtn.TextColor3 = Color3.new(1,1,1)
  431. aimKeyBtn.AutoButtonColor = false
  432. aimKeyBtn.Text = Settings.KeybindAim
  433.  
  434. local waitingForKey = false
  435. aimKeyBtn.MouseEnter:Connect(function() aimKeyBtn.BackgroundColor3 = Color3.fromRGB(200,50,255) end)
  436. aimKeyBtn.MouseLeave:Connect(function() aimKeyBtn.BackgroundColor3 = Color3.fromRGB(170,0,255) end)
  437.  
  438. aimKeyBtn.MouseButton1Click:Connect(function()
  439.     if waitingForKey then return end
  440.     waitingForKey = true
  441.     aimKeyBtn.Text = "Press Key..."
  442.     local conn
  443.     conn = UIS.InputBegan:Connect(function(input, gp)
  444.         if gp then return end
  445.         if input.UserInputType == Enum.UserInputType.Keyboard then
  446.             Settings.KeybindAim = input.KeyCode.Name
  447.             aimKeyBtn.Text = Settings.KeybindAim
  448.             saveConfig()
  449.             waitingForKey = false
  450.             conn:Disconnect()
  451.         elseif input.UserInputType.Name:match("^MouseButton%d$") then
  452.             Settings.KeybindAim = input.UserInputType.Name
  453.             aimKeyBtn.Text = Settings.KeybindAim
  454.             saveConfig()
  455.             waitingForKey = false
  456.             conn:Disconnect()
  457.         end
  458.     end)
  459. end)
  460. ypos += 60
  461.  
  462. -- Toggle UI keybind changer (on misc page)
  463. local toggleKeyLbl = Instance.new("TextLabel", miscPage)
  464. toggleKeyLbl.Size = UDim2.new(0, 300, 0, 22)
  465. toggleKeyLbl.Position = UDim2.new(0, 20, 0, 10)
  466. toggleKeyLbl.BackgroundTransparency = 1
  467. toggleKeyLbl.Font = Enum.Font.Gotham
  468. toggleKeyLbl.TextSize = 16
  469. toggleKeyLbl.TextColor3 = Color3.fromRGB(220,220,220)
  470. toggleKeyLbl.Text = "Toggle UI Keybind: " .. Settings.KeybindToggleUI
  471.  
  472. local toggleKeyBtn = Instance.new("TextButton", miscPage)
  473. toggleKeyBtn.Size = UDim2.new(0, 300, 0, 38)
  474. toggleKeyBtn.Position = UDim2.new(0, 20, 0, 40)
  475. toggleKeyBtn.BackgroundColor3 = Color3.fromRGB(170,0,255)
  476. toggleKeyBtn.Font = Enum.Font.GothamSemibold
  477. toggleKeyBtn.TextSize = 18
  478. toggleKeyBtn.TextColor3 = Color3.new(1,1,1)
  479. toggleKeyBtn.AutoButtonColor = false
  480. toggleKeyBtn.Text = Settings.KeybindToggleUI
  481.  
  482. toggleKeyBtn.MouseEnter:Connect(function() toggleKeyBtn.BackgroundColor3 = Color3.fromRGB(200,50,255) end)
  483. toggleKeyBtn.MouseLeave:Connect(function() toggleKeyBtn.BackgroundColor3 = Color3.fromRGB(170,0,255) end)
  484.  
  485. toggleKeyBtn.MouseButton1Click:Connect(function()
  486.     if waitingForKey then return end
  487.     waitingForKey = true
  488.     toggleKeyBtn.Text = "Press Key..."
  489.     local conn
  490.     conn = UIS.InputBegan:Connect(function(input, gp)
  491.         if gp then return end
  492.         if input.UserInputType == Enum.UserInputType.Keyboard then
  493.             Settings.KeybindToggleUI = input.KeyCode.Name
  494.             toggleKeyBtn.Text = Settings.KeybindToggleUI
  495.             toggleKeyLbl.Text = "Toggle UI Keybind: " .. Settings.KeybindToggleUI
  496.             saveConfig()
  497.             waitingForKey = false
  498.             conn:Disconnect()
  499.         elseif input.UserInputType.Name:match("^MouseButton%d$") then
  500.             Settings.KeybindToggleUI = input.UserInputType.Name
  501.             toggleKeyBtn.Text = Settings.KeybindToggleUI
  502.             toggleKeyLbl.Text = "Toggle UI Keybind: " .. Settings.KeybindToggleUI
  503.             saveConfig()
  504.             waitingForKey = false
  505.             conn:Disconnect()
  506.         end
  507.     end)
  508. end)
  509.  
  510. -- ESP section (ESP page)
  511. local espY = 10
  512. local function makeESPToggle(text, key)
  513.     local btn = Instance.new("TextButton", espPage)
  514.     btn.Size = UDim2.new(0, 300, 0, 38)
  515.     btn.Position = UDim2.new(0, 20, 0, espY)
  516.     btn.BackgroundColor3 = Color3.fromRGB(170, 0, 255)
  517.     btn.Font = Enum.Font.GothamSemibold
  518.     btn.TextSize = 18
  519.     btn.AutoButtonColor = false
  520.     btn.TextColor3 = Color3.new(1,1,1)
  521.     btn.Text = Settings[key] and text .. ": ON" or text .. ": OFF"
  522.     btn.MouseEnter:Connect(function() btn.BackgroundColor3 = Color3.fromRGB(200, 50, 255) end)
  523.     btn.MouseLeave:Connect(function() btn.BackgroundColor3 = Color3.fromRGB(170, 0, 255) end)
  524.     btn.MouseButton1Click:Connect(function()
  525.         Settings[key] = not Settings[key]
  526.         btn.Text = Settings[key] and text .. ": ON" or text .. ": OFF"
  527.         saveConfig()
  528.     end)
  529.     espY += 50
  530. end
  531.  
  532. makeESPToggle("ESP Enabled", "ESPEnabled")
  533. makeESPToggle("ESP Boxes", "ESPBoxes")
  534. makeESPToggle("ESP Names", "ESPNames")
  535. makeESPToggle("ESP Health", "ESPHealth")
  536.  
  537. -- ESP drawing tables
  538. local ESPDrawings = {}
  539.  
  540. local function createESPForPlayer(p)
  541.     if ESPDrawings[p] then return end
  542.  
  543.     local box = Drawing.new("Square")
  544.     box.Color = Color3.fromRGB(170, 0, 255)
  545.     box.Thickness = 2
  546.     box.Filled = false
  547.  
  548.     local nameTag = Drawing.new("Text")
  549.     nameTag.Color = Color3.fromRGB(255,255,255)
  550.     nameTag.Outline = true
  551.     nameTag.OutlineColor = Color3.new(0,0,0)
  552.     nameTag.Size = 14
  553.     nameTag.Font = 2
  554.  
  555.     local healthText = Drawing.new("Text")
  556.     healthText.Color = Color3.fromRGB(0,255,0)
  557.     healthText.Outline = true
  558.     healthText.OutlineColor = Color3.new(0,0,0)
  559.     healthText.Size = 14
  560.     healthText.Font = 2
  561.  
  562.     ESPDrawings[p] = {Box=box, Name=nameTag, Health=healthText}
  563. end
  564.  
  565. local function removeESPForPlayer(p)
  566.     if ESPDrawings[p] then
  567.         for _,v in pairs(ESPDrawings[p]) do
  568.             v:Remove()
  569.         end
  570.         ESPDrawings[p] = nil
  571.     end
  572. end
  573.  
  574. -- ESP Update loop
  575. RS.RenderStepped:Connect(function()
  576.     for _,p in pairs(game:GetService("Players"):GetPlayers()) do
  577.         if p ~= PL and p.Character and p.Character:FindFirstChild("HumanoidRootPart") and Settings.ESPEnabled then
  578.             createESPForPlayer(p)
  579.             local drawings = ESPDrawings[p]
  580.             local root = p.Character.HumanoidRootPart
  581.             local screenPos, onScreen = Cam:WorldToViewportPoint(root.Position)
  582.             if onScreen and screenPos.Z > 0 then
  583.                 local size = 1500 / screenPos.Z
  584.                 local x, y = screenPos.X, screenPos.Y
  585.  
  586.                 -- Box
  587.                 if Settings.ESPBoxes then
  588.                     drawings.Box.Visible = true
  589.                     drawings.Box.Size = Vector2.new(size, size * 2)
  590.                     drawings.Box.Position = Vector2.new(x - size/2, y - size)
  591.                     drawings.Box.Color = Color3.fromRGB(170, 0, 255)
  592.                 else
  593.                     drawings.Box.Visible = false
  594.                 end
  595.  
  596.                 -- Name
  597.                 if Settings.ESPNames then
  598.                     drawings.Name.Visible = true
  599.                     drawings.Name.Text = p.Name
  600.                     drawings.Name.Position = Vector2.new(x, y - size - 20)
  601.                 else
  602.                     drawings.Name.Visible = false
  603.                 end
  604.  
  605.                 -- Health
  606.                 if Settings.ESPHealth then
  607.                     local hum = p.Character:FindFirstChild("Humanoid")
  608.                     if hum then
  609.                         drawings.Health.Visible = true
  610.                         drawings.Health.Text = string.format("%.0f", hum.Health)
  611.                         drawings.Health.Position = Vector2.new(x, y + size + 5)
  612.                         drawings.Health.Color = hum.Health > 50 and Color3.fromRGB(0,255,0) or Color3.fromRGB(255,0,0)
  613.                     else
  614.                         drawings.Health.Visible = false
  615.                     end
  616.                 else
  617.                     drawings.Health.Visible = false
  618.                 end
  619.             else
  620.                 -- Not on screen, hide all
  621.                 drawings.Box.Visible = false
  622.                 drawings.Name.Visible = false
  623.                 drawings.Health.Visible = false
  624.             end
  625.         else
  626.             -- Remove ESP drawings if player not valid or ESP off
  627.             removeESPForPlayer(p)
  628.         end
  629.     end
  630. end)
  631.  
  632. -- Input handlers
  633. UIS.InputBegan:Connect(function(input, gp)
  634.     if gp then return end
  635.     if inputMatchesKey(input, Settings.KeybindAim) and Settings.AimbotEnabled then
  636.         aiming = true
  637.     end
  638.     if inputMatchesKey(input, Settings.KeybindToggleUI) then
  639.         gui.Enabled = not gui.Enabled
  640.     end
  641. end)
  642.  
  643. UIS.InputEnded:Connect(function(input)
  644.     if inputMatchesKey(input, Settings.KeybindAim) then
  645.         aiming = false
  646.     end
  647. end)
  648.  
  649. -- Hint label
  650. local hint = Instance.new("TextLabel", bg)
  651. hint.Size = UDim2.new(1,0,0,26)
  652. hint.Position = UDim2.new(0,0,1,-26)
  653. hint.BackgroundTransparency = 1
  654. hint.Font = Enum.Font.GothamItalic
  655. hint.TextSize = 14
  656. hint.TextColor3 = Color3.fromRGB(200,200,200)
  657. hint.Text = "Hold Aim Key to aim • Change keys and settings in GUI"
  658.  
  659. print("Luna Scripts loaded successfully.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement