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 Mouse = game.Players.LocalPlayer:GetMouse()
- local CamlockState = false
- local AutoShootState = false
- local clickInterval = 0.5
- local Prediction = 0.2
- local XPrediction = 0.15
- local YPrediction = 0.15
- local enemy = nil
- local glowingPart = nil
- 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:GetService("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
- local function IsWallBetween(localPlayer, targetPart)
- local origin = localPlayer.Character.HumanoidRootPart.Position
- local direction = (targetPart.Position - origin).unit * (targetPart.Position - origin).magnitude
- local raycastParams = RaycastParams.new()
- raycastParams.FilterDescendantsInstances = {localPlayer.Character}
- raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
- local ray = workspace:Raycast(origin, direction, raycastParams)
- return ray and ray.Instance and ray.Instance:IsDescendantOf(workspace) and not ray.Instance:IsDescendantOf(targetPart.Parent)
- end
- local function autoShoot()
- local tool = LocalPlayer.Character:FindFirstChildOfClass("Tool")
- if tool and tool:FindFirstChild("Handle") then
- tool:Activate()
- end
- end
- local function startAutoShoot()
- while AutoShootState do
- if enemy and not IsWallBetween(LocalPlayer, enemy) then
- autoShoot()
- end
- wait(clickInterval)
- end
- end
- RunService.Heartbeat:Connect(function()
- if CamlockState and enemy then
- local camera = workspace.CurrentCamera
- local predictedPosition = enemy.Position + enemy.Velocity * Prediction + Vector3.new(enemy.Velocity.X * XPrediction, enemy.Velocity.Y * YPrediction, 0)
- camera.CFrame = CFrame.new(camera.CFrame.p, predictedPosition)
- if glowingPart then
- glowingPart.Enabled = true
- glowingPart.Parent = enemy
- glowingPart.Face = Enum.NormalId.Front
- end
- else
- if glowingPart then
- glowingPart:Destroy()
- end
- end
- end)
- local CamlockGUI = Instance.new("ScreenGui")
- local CamlockFrame = Instance.new("Frame")
- local CamlockButton = Instance.new("TextButton")
- local UICorner_1 = Instance.new("UICorner")
- local UIStroke_1 = Instance.new("UIStroke")
- local AutoShootGUI = Instance.new("ScreenGui")
- local AutoShootFrame = Instance.new("Frame")
- local AutoShootButton = Instance.new("TextButton")
- local UICorner_2 = Instance.new("UICorner")
- local UIStroke_2 = Instance.new("UIStroke")
- CamlockGUI.Name = "CamlockGUI"
- CamlockGUI.Parent = game.CoreGui
- CamlockGUI.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
- CamlockFrame.Parent = CamlockGUI
- CamlockFrame.BackgroundColor3 = Color3.fromRGB(48, 25, 52)
- CamlockFrame.BorderSizePixel = 0
- CamlockFrame.Position = UDim2.new(0.1, 0, 0.1, 0)
- CamlockFrame.Size = UDim2.new(0, 202, 0, 70)
- CamlockFrame.Active = true
- CamlockFrame.Draggable = true
- UICorner_1.CornerRadius = UDim.new(0, 12)
- UICorner_1.Parent = CamlockFrame
- CamlockButton.Parent = CamlockFrame
- CamlockButton.BackgroundColor3 = Color3.fromRGB(159, 43, 104)
- CamlockButton.BorderSizePixel = 0
- CamlockButton.Position = UDim2.new(0.079, 0, 0.185, 0)
- CamlockButton.Size = UDim2.new(0, 170, 0, 44)
- CamlockButton.Font = Enum.Font.SourceSansSemibold
- CamlockButton.Text = "Camlock OFF"
- CamlockButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- CamlockButton.TextScaled = true
- CamlockButton.TextWrapped = true
- AutoShootGUI.Name = "AutoShootGUI"
- AutoShootGUI.Parent = game.CoreGui
- AutoShootGUI.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
- AutoShootFrame.Parent = AutoShootGUI
- AutoShootFrame.BackgroundColor3 = Color3.fromRGB(48, 25, 52)
- AutoShootFrame.BorderSizePixel = 0
- AutoShootFrame.Position = UDim2.new(0.3, 0, 0.1, 0)
- AutoShootFrame.Size = UDim2.new(0, 202, 0, 70)
- AutoShootFrame.Active = true
- AutoShootFrame.Draggable = true
- UICorner_2.CornerRadius = UDim.new(0, 12)
- UICorner_2.Parent = AutoShootFrame
- AutoShootButton.Parent = AutoShootFrame
- AutoShootButton.BackgroundColor3 = Color3.fromRGB(191, 64, 191)
- AutoShootButton.BorderSizePixel = 0
- AutoShootButton.Position = UDim2.new(0.079, 0, 0.185, 0)
- AutoShootButton.Size = UDim2.new(0, 170, 0, 44)
- AutoShootButton.Font = Enum.Font.SourceSansSemibold
- AutoShootButton.Text = "AutoShoot OFF"
- AutoShootButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- AutoShootButton.TextScaled = true
- AutoShootButton.TextWrapped = true
- CamlockButton.MouseButton1Click:Connect(function()
- CamlockState = not CamlockState
- CamlockButton.Text = CamlockState and "Camlock ON" or "Camlock OFF"
- enemy = CamlockState and FindNearestEnemy() or nil
- if CamlockState then
- glowingPart = Instance.new("SurfaceLight")
- glowingPart.Color = Color3.fromRGB(128, 0, 255)
- glowingPart.Brightness = 10
- else
- if glowingPart then
- glowingPart:Destroy()
- end
- end
- end)
- AutoShootButton.MouseButton1Click:Connect(function()
- AutoShootState = not AutoShootState
- AutoShootButton.Text = AutoShootState and "AutoShoot ON" or "AutoShoot OFF"
- if AutoShootState then
- startAutoShoot()
- end
- end)
- UIStroke_1.Parent = CamlockFrame
- UIStroke_1.Thickness = 2
- UIStroke_1.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
- UIStroke_1.Color = Color3.fromRGB(255, 255, 255)
- UIStroke_2.Parent = AutoShootFrame
- UIStroke_2.Thickness = 2
- UIStroke_2.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
- UIStroke_2.Color = Color3.fromRGB(255, 255, 255)
- local purpleColors = {
- Color3.fromRGB(159, 43, 104),
- Color3.fromRGB(191, 64, 191),
- Color3.fromRGB(128, 0, 32),
- Color3.fromRGB(112, 41, 99)
- }
- local function SmoothPurpleRainbowEffect()
- local step = 0
- while true do
- local t = (math.sin(step) + 1) / 2
- local colorIndex1 = math.floor(step % #purpleColors) + 1
- local colorIndex2 = colorIndex1 % #purpleColors + 1
- local color = purpleColors[colorIndex1]:Lerp(purpleColors[colorIndex2], t)
- UIStroke_1.Color = color
- UIStroke_2.Color = color
- CamlockButton.TextColor3 = color
- AutoShootButton.TextColor3 = color
- step = step + 0.02
- wait(0.01)
- end
- end
- spawn(SmoothPurpleRainbowEffect)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement