merchants

Silent Test

Jul 31st, 2025
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.49 KB | None | 0 0
  1. --[[
  2.     🔧 Controller Silent Aim + Rainbow ESP Test (Executor Version)
  3.     ▶ Press DPadRight → Select closest player to cursor
  4.     ▶ That player gets a rainbow outline (only you see it)
  5.     ▶ When you equip and shoot your gun, bullets silently aim at them
  6.     ▶ No red visual bullet appears
  7. --]]
  8.  
  9. local Players = game:GetService("Players")
  10. local Camera = workspace.CurrentCamera
  11. local UIS = game:GetService("UserInputService")
  12. local LP = Players.LocalPlayer
  13.  
  14. _G.SelectedTarget = nil
  15.  
  16. -- 🔍 Get closest player to cursor
  17. local function GetClosestPlayer()
  18.     local mouse = LP:GetMouse()
  19.     local closest = nil
  20.     local shortestDist = math.huge
  21.  
  22.     for _, player in ipairs(Players:GetPlayers()) do
  23.         if player ~= LP and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
  24.             local screenPos, onScreen = Camera:WorldToViewportPoint(player.Character.HumanoidRootPart.Position)
  25.             if onScreen then
  26.                 local dist = (Vector2.new(screenPos.X, screenPos.Y) - Vector2.new(mouse.X, mouse.Y)).Magnitude
  27.                 if dist < shortestDist then
  28.                     shortestDist = dist
  29.                     closest = player
  30.                 end
  31.             end
  32.         end
  33.     end
  34.  
  35.     return closest
  36. end
  37.  
  38. -- 🌈 Apply rainbow highlight to selected target
  39. local function ApplyRainbowHighlight(player)
  40.     local existing = player.Character:FindFirstChild("TargetESP")
  41.     if existing then existing:Destroy() end
  42.  
  43.     local h = Instance.new("Highlight")
  44.     h.Name = "TargetESP"
  45.     h.Adornee = player.Character
  46.     h.FillTransparency = 1
  47.     h.OutlineTransparency = 0
  48.     h.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
  49.     h.Parent = player.Character
  50.  
  51.     task.spawn(function()
  52.         local hue = 0
  53.         while _G.SelectedTarget == player and h.Parent do
  54.             hue = (hue + 0.01) % 1
  55.             h.OutlineColor = Color3.fromHSV(hue, 1, 1)
  56.             task.wait(0.05)
  57.         end
  58.         h:Destroy()
  59.     end)
  60. end
  61.  
  62. -- 🎮 DPadRight input to select target
  63. UIS.InputBegan:Connect(function(input, gpe)
  64.     if gpe then return end
  65.     if input.KeyCode == Enum.KeyCode.DPadRight then
  66.         local target = GetClosestPlayer()
  67.         if target then
  68.             _G.SelectedTarget = target
  69.             ApplyRainbowHighlight(target)
  70.         end
  71.     end
  72. end)
  73.  
  74. -- 🔫 Setup silent aim when gun is fired
  75. local function GetEquippedToolWithMuzzle()
  76.     local char = LP.Character
  77.     if not char then return nil end
  78.  
  79.     for _, item in ipairs(char:GetChildren()) do
  80.         if item:IsA("Tool") and item:FindFirstChild("Muzzle") then
  81.             return item
  82.         end
  83.     end
  84.  
  85.     return nil
  86. end
  87.  
  88. local function SetupSilentAim()
  89.     local tool = GetEquippedToolWithMuzzle()
  90.     if not tool then return end
  91.     local muzzle = tool:FindFirstChild("Muzzle")
  92.     if not muzzle then return end
  93.  
  94.     tool.Activated:Connect(function()
  95.         if not _G.SelectedTarget then return end
  96.         local hrp = _G.SelectedTarget.Character and _G.SelectedTarget.Character:FindFirstChild("HumanoidRootPart")
  97.         if not hrp then return end
  98.  
  99.         local origin = muzzle.Position
  100.         local direction = (hrp.Position - origin).Unit
  101.         local ray = Ray.new(origin, direction * 1000)
  102.         local hitPart, hitPos = workspace:FindPartOnRay(ray, LP.Character)
  103.  
  104.         -- Simulate silent hit (you can hook remote events here)
  105.         if hitPart then
  106.             print("Silent Aim Hit:", hitPart.Name, "at", hitPos)
  107.         else
  108.             print("Silent Aim Missed.")
  109.         end
  110.     end)
  111. end
  112.  
  113. -- 🔄 Hook tool equip
  114. LP.CharacterAdded:Connect(function(char)
  115.     char.ChildAdded:Connect(function(obj)
  116.         if obj:IsA("Tool") and obj:FindFirstChild("Muzzle") then
  117.             task.wait(0.2)
  118.             SetupSilentAim()
  119.         end
  120.     end)
  121. end)
  122.  
  123. -- ▶ Set up if tool is already equipped
  124. task.wait(1)
  125. SetupSilentAim()
  126.  
Advertisement
Add Comment
Please, Sign In to add comment