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 UserInputService = game:GetService("UserInputService")
- local LocalPlayer = Players.LocalPlayer
- local CamlockState = false
- local Prediction = 0.16289706
- local ESPBillboard = nil -- Store the ESP for the Camlock target
- local currentTarget = nil -- Store the current target for Camlock
- -- Function to find the nearest enemy
- function FindNearestEnemy()
- local ClosestDistance, ClosestPlayer = math.huge, nil
- local CenterPosition = Vector2.new(game:GetService("GuiService"):GetScreenResolution().X / 2, game:GetService("GuiService"):GetScreenResolution().Y / 2)
- for _, Player in ipairs(Players:GetPlayers()) do
- if Player ~= LocalPlayer then
- local Character = Player.Character
- if Character and Character:FindFirstChild("HumanoidRootPart") and Character.Humanoid.Health > 0 then
- local Position, IsVisibleOnViewport = game.Workspace.CurrentCamera:WorldToViewportPoint(Character.HumanoidRootPart.Position)
- if IsVisibleOnViewport then
- local Distance = (CenterPosition - Vector2.new(Position.X, Position.Y)).Magnitude
- if Distance < ClosestDistance then
- ClosestPlayer = Character.HumanoidRootPart
- ClosestDistance = Distance
- end
- end
- end
- end
- end
- return ClosestPlayer
- end
- -- Function to create ESP for the Camlock target
- local function CreateESP(Part, PlayerName)
- -- Remove the previous ESP if it exists
- if ESPBillboard then
- ESPBillboard:Destroy()
- ESPBillboard = nil
- end
- -- Create the BillboardGui for the ESP
- local Billboard = Instance.new("BillboardGui")
- Billboard.Name = PlayerName .. "_ESP"
- Billboard.Adornee = Part
- Billboard.Size = UDim2.new(0, 200, 0, 50) -- ESP label size
- Billboard.StudsOffset = Vector3.new(0, 3, 0) -- Offset the ESP above the target
- Billboard.AlwaysOnTop = true
- Billboard.Parent = game.CoreGui
- -- Create the TextLabel to show the player's name
- local TextLabel = Instance.new("TextLabel")
- TextLabel.Size = UDim2.new(1, 0, 1, 0)
- TextLabel.BackgroundTransparency = 1
- TextLabel.Text = PlayerName
- TextLabel.TextSize = 14
- TextLabel.TextStrokeTransparency = 0.5
- TextLabel.TextColor3 = Color3.fromRGB(0, 255, 255) -- Start with ocean blue
- TextLabel.Font = Enum.Font.SourceSansBold
- TextLabel.Parent = Billboard
- -- Store the ESP object for removal later
- ESPBillboard = Billboard
- -- Start the ocean-blue rainbow effect
- spawn(function()
- local hue = 180
- while ESPBillboard and ESPBillboard.Parent do
- local color = Color3.fromHSV(hue / 360, 0.8, 1)
- TextLabel.TextColor3 = color
- hue = (hue + 1) % 360
- if hue < 180 or hue > 240 then hue = 180 end -- Keep the hue within blue range
- wait(0.05)
- end
- end)
- end
- -- Function to remove ESP when no target is selected
- local function RemoveESP()
- if ESPBillboard then
- ESPBillboard:Destroy()
- ESPBillboard = nil
- end
- end
- -- Function to aim the camera at the nearest enemy's HumanoidRootPart
- RunService.Heartbeat:Connect(function()
- if CamlockState == true then
- if currentTarget then
- local camera = workspace.CurrentCamera
- -- Predict the target's position and adjust the camera to look at it
- camera.CFrame = CFrame.new(camera.CFrame.Position, currentTarget.Position + currentTarget.Velocity * Prediction)
- end
- end
- end)
- -- Toggle the camlock and ESP when a target is locked
- UserInputService.InputBegan:Connect(function(input, gameProcessed)
- if gameProcessed then return end -- Ignore input if the game is using the input
- if input.KeyCode == Enum.KeyCode.Q then
- CamlockState = not CamlockState
- if CamlockState then
- currentTarget = FindNearestEnemy() -- Lock onto the nearest enemy
- if currentTarget then
- -- Activate ESP for the new target
- CreateESP(currentTarget, currentTarget.Parent.Name)
- end
- else
- -- Disable Camlock and remove ESP
- currentTarget = nil
- RemoveESP()
- end
- end
- end)
- -- PURIFY UI Setup (for controlling Camlock and ESP)
- local PURIFY = Instance.new("ScreenGui")
- local Frame = Instance.new("Frame")
- local UICorner = Instance.new("UICorner")
- local TextButton = Instance.new("TextButton")
- local UICorner_2 = Instance.new("UICorner")
- local UIStroke = Instance.new("UIStroke")
- -- Properties
- PURIFY.Name = "PURIFY"
- PURIFY.Parent = game.CoreGui
- PURIFY.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
- Frame.Parent = PURIFY
- Frame.BackgroundColor3 = Color3.fromRGB(0, 0, 0) -- Pure black for a sleek look
- Frame.BorderColor3 = Color3.fromRGB(0, 0, 0)
- Frame.BorderSizePixel = 0
- Frame.Position = UDim2.new(0.133798108, 0, 0.20107238, 0)
- Frame.Size = UDim2.new(0, 202, 0, 70)
- Frame.Active = true
- Frame.Draggable = true
- UICorner.Parent = Frame
- TextButton.Parent = Frame
- TextButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- TextButton.BackgroundTransparency = 5.000
- TextButton.BorderColor3 = Color3.fromRGB(0, 0, 0)
- TextButton.BorderSizePixel = 0
- TextButton.Position = UDim2.new(0.0792079195, 0, 0.18571429, 0)
- TextButton.Size = UDim2.new(0, 170, 0, 44)
- TextButton.Font = Enum.Font.SourceSansSemibold
- TextButton.Text = "PURIFY OFF" -- Initial text when Camlock is off
- TextButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- TextButton.TextScaled = true
- TextButton.TextSize = 11.000
- TextButton.TextWrapped = true
- -- Add UIStroke for sea-blue gradient effect
- UIStroke.Parent = Frame
- UIStroke.Thickness = 2
- UIStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
- UIStroke.Color = Color3.fromRGB(0, 255, 255) -- Initial sea blue color
- -- Toggle the camlock and PURIFY mode on button click
- TextButton.MouseButton1Click:Connect(function()
- CamlockState = not CamlockState
- TextButton.Text = CamlockState and "PURIFY ON" or "PURIFY OFF" -- Toggle between ON and OFF
- if CamlockState then
- currentTarget = FindNearestEnemy()
- if currentTarget then
- CreateESP(currentTarget, currentTarget.Parent.Name) -- Activate ESP for the target
- end
- else
- currentTarget = nil
- RemoveESP() -- Remove ESP when Camlock is turned off
- end
- end)
- UICorner_2.Parent = TextButton
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement