Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local RunService = game:GetService("RunService")
- local LocalPlayer = Players.LocalPlayer
- local Camera = workspace.CurrentCamera
- local ESPEnabled = false
- local AimbotEnabled = false
- local AimbotConnection -- To store the RenderStepped connection
- -- Function to create a rainbow effect
- local function getRainbowColor(step)
- local hue = step % 1
- return Color3.fromHSV(hue, 1, 1)
- end
- -- Function to create a box ESP for a player
- local function createBoxESP(player)
- local function addESP()
- if not player.Character then return end
- local head = player.Character:WaitForChild("Head", 5)
- if not head then return end
- -- Check if ESP already exists
- if head:FindFirstChild("ESPBox") then return end
- -- Create BillboardGui
- local billboard = Instance.new("BillboardGui")
- billboard.Name = "ESPBox"
- billboard.Parent = head
- billboard.Adornee = head
- billboard.Size = UDim2.new(4, 0, 5, 0) -- Adjust size to fit the player
- billboard.StudsOffset = Vector3.new(0, 2, 0) -- Adjust height above head
- billboard.AlwaysOnTop = true
- -- Create Frame for the box
- local boxFrame = Instance.new("Frame")
- boxFrame.Parent = billboard
- boxFrame.Size = UDim2.new(1, 0, 1, 0)
- boxFrame.BackgroundTransparency = 0.8 -- Semi-transparent
- boxFrame.BorderSizePixel = 2
- -- Rainbow effect
- local step = 0
- RunService.RenderStepped:Connect(function()
- if ESPEnabled and billboard.Parent then
- step = step + 0.01
- boxFrame.BackgroundColor3 = getRainbowColor(step)
- end
- end)
- end
- -- Connect to CharacterAdded in case the character respawns
- player.CharacterAdded:Connect(function()
- addESP()
- end)
- -- Add ESP to the current character if available
- addESP()
- end
- -- Function to remove ESP when a player leaves
- local function removeBoxESP(player)
- if player.Character then
- local head = player.Character:FindFirstChild("Head")
- if head and head:FindFirstChild("ESPBox") then
- head.ESPBox:Destroy()
- end
- end
- end
- -- Function to toggle ESP
- local function toggleESP()
- ESPEnabled = not ESPEnabled
- if ESPEnabled then
- for _, player in ipairs(Players:GetPlayers()) do
- if player ~= LocalPlayer then
- createBoxESP(player)
- end
- end
- Players.PlayerAdded:Connect(function(player)
- if player ~= LocalPlayer then
- createBoxESP(player)
- end
- end)
- Players.PlayerRemoving:Connect(removeBoxESP)
- else
- for _, player in ipairs(Players:GetPlayers()) do
- removeBoxESP(player)
- end
- end
- end
- -- Function to get the closest player's head with team check
- local function getClosestPlayer()
- local closestPlayer = nil
- local shortestDistance = math.huge
- for _, player in ipairs(Players:GetPlayers()) do
- if player ~= LocalPlayer and player.Team ~= LocalPlayer.Team and player.Character and player.Character:FindFirstChild("Head") then
- local head = player.Character.Head
- local distance = (head.Position - LocalPlayer.Character.Head.Position).Magnitude
- if distance < shortestDistance then
- shortestDistance = distance
- closestPlayer = head
- end
- end
- end
- return closestPlayer
- end
- -- Function to toggle Aimbot
- local function toggleAimbot()
- AimbotEnabled = not AimbotEnabled
- if AimbotEnabled then
- -- Connect to RenderStepped for aimbot functionality
- AimbotConnection = RunService.RenderStepped:Connect(function()
- local closestHead = getClosestPlayer()
- if closestHead then
- Camera.CFrame = CFrame.new(Camera.CFrame.Position, closestHead.Position)
- end
- end)
- else
- -- Disconnect the RenderStepped connection to stop aimbot
- if AimbotConnection then
- AimbotConnection:Disconnect()
- AimbotConnection = nil
- end
- end
- end
- -- Create GUI
- local function createGUI()
- local screenGui = Instance.new("ScreenGui")
- screenGui.Name = "ESP_Aimbot_Toggle"
- screenGui.Parent = LocalPlayer:WaitForChild("PlayerGui")
- -- ESP Button
- local espButton = Instance.new("TextButton")
- espButton.Parent = screenGui
- espButton.Size = UDim2.new(0, 200, 0, 50)
- espButton.Position = UDim2.new(0, 10, 0, 10)
- espButton.Text = "Toggle ESP"
- espButton.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
- espButton.TextScaled = true
- espButton.MouseButton1Click:Connect(toggleESP)
- -- Aimbot Button
- local aimbotButton = Instance.new("TextButton")
- aimbotButton.Parent = screenGui
- aimbotButton.Size = UDim2.new(0, 200, 0, 50)
- aimbotButton.Position = UDim2.new(0, 10, 0, 70)
- aimbotButton.Text = "Toggle Aimbot"
- aimbotButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
- aimbotButton.TextScaled = true
- aimbotButton.MouseButton1Click:Connect(toggleAimbot)
- -- Super ESP Text
- local superText = Instance.new("TextLabel")
- superText.Parent = screenGui
- superText.Size = UDim2.new(0, 300, 0, 50)
- superText.Position = UDim2.new(0, 10, 0, 130)
- superText.Text = "Super ESP by ilovedeltax666"
- superText.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
- superText.TextColor3 = Color3.fromRGB(255, 255, 255)
- superText.TextScaled = true
- superText.BorderSizePixel = 0
- end
- -- Initialize GUI
- createGUI()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement