Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local RunService = game:GetService("RunService")
- local UserInputService = game:GetService("UserInputService")
- local Workspace = game:GetService("Workspace")
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local Camera = Workspace.CurrentCamera
- local LocalPlayer = Players.LocalPlayer
- -- Feature state
- local silentAimActive = false
- local espActive = false
- local espList = {}
- -- UI Setup
- local ScreenGui = Instance.new("ScreenGui")
- ScreenGui.Name = "ControlPanel"
- ScreenGui.ResetOnSpawn = false
- ScreenGui.Parent = LocalPlayer:WaitForChild("PlayerGui")
- local function createToggleButton(name, position, callback)
- local button = Instance.new("TextButton")
- button.Size = UDim2.new(0, 150, 0, 40)
- button.Position = position
- button.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
- button.TextColor3 = Color3.fromRGB(255, 255, 255)
- button.TextSize = 18
- button.Font = Enum.Font.SourceSansBold
- button.Text = name .. ": OFF"
- button.Parent = ScreenGui
- local isOn = false
- button.MouseButton1Click:Connect(function()
- isOn = not isOn
- button.Text = name .. ": " .. (isOn and "ON" or "OFF")
- callback(isOn)
- end)
- end
- -- Toggle Buttons
- createToggleButton("Silent Aim", UDim2.new(0, 20, 0, 100), function(state)
- silentAimActive = state
- end)
- createToggleButton("ESP", UDim2.new(0, 20, 0, 150), function(state)
- espActive = state
- if not state then
- -- Hide all ESP immediately
- for _, box in pairs(espList) do
- if box and box.drawing then
- box.drawing.Visible = false
- end
- end
- end
- end)
- -- Nearest Head
- local function getNearestHead()
- if not LocalPlayer.Character or not LocalPlayer.Character:FindFirstChild("HumanoidRootPart") then return nil end
- local closest = nil
- local shortest = math.huge
- for _, player in pairs(Players:GetPlayers()) do
- if player ~= LocalPlayer and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
- local dist = (player.Character.HumanoidRootPart.Position - LocalPlayer.Character.HumanoidRootPart.Position).Magnitude
- if dist < shortest then
- shortest = dist
- closest = player
- end
- end
- end
- if closest and closest.Character and closest.Character:FindFirstChild("Head") then
- return closest.Character.Head
- end
- return nil
- end
- -- Silent Aim
- UserInputService.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 and silentAimActive then
- local target = getNearestHead()
- if target then
- Camera.CFrame = CFrame.new(Camera.CFrame.Position, target.Position)
- ReplicatedStorage.Remotes.Attack:FireServer(target)
- end
- end
- end)
- -- Setup ESP
- local function createESP(player)
- if player == LocalPlayer then return end
- local box = Drawing.new("Quad")
- box.Thickness = 2
- box.Color = Color3.fromRGB(0, 0, 255)
- box.Transparency = 1
- box.Visible = false
- espList[player] = {
- drawing = box,
- connection = nil
- }
- -- Clean up if player leaves
- player.AncestryChanged:Connect(function()
- if not player:IsDescendantOf(game) and espList[player] then
- box:Remove()
- espList[player] = nil
- end
- end)
- end
- -- Add ESP to all players
- for _, player in pairs(Players:GetPlayers()) do
- createESP(player)
- end
- -- Player joins
- Players.PlayerAdded:Connect(function(player)
- createESP(player)
- end)
- -- Player leaves
- Players.PlayerRemoving:Connect(function(player)
- if espList[player] then
- espList[player].drawing:Remove()
- espList[player] = nil
- end
- end)
- -- Main ESP Loop
- RunService.RenderStepped:Connect(function()
- for player, data in pairs(espList) do
- local box = data.drawing
- if espActive and player.Character and player.Character:FindFirstChild("HumanoidRootPart") and player.Character:FindFirstChild("Head") then
- local root = player.Character.HumanoidRootPart
- local head = player.Character.Head
- local rootPos, onScreen1 = Camera:WorldToViewportPoint(root.Position)
- local headPos, onScreen2 = Camera:WorldToViewportPoint(head.Position + Vector3.new(0, 0.5, 0))
- if onScreen1 and onScreen2 then
- box.PointA = Vector2.new(rootPos.X - 15, rootPos.Y + 30)
- box.PointB = Vector2.new(rootPos.X + 15, rootPos.Y + 30)
- box.PointC = Vector2.new(headPos.X + 15, headPos.Y)
- box.PointD = Vector2.new(headPos.X - 15, headPos.Y)
- box.Visible = true
- else
- box.Visible = false
- end
- else
- box.Visible = false
- end
- end
- end)
- print("Silent Aim + ESP UI loaded with clean ESP toggle.")
Advertisement
Comments
-
- BRO THIS IS THE BEST SCRIPT
-
- thank you!
-
User was banned
-
- sure!
-
-
- more coming
Add Comment
Please, Sign In to add comment