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 AutoShootState = false
- local clickInterval = 0.5
- local enemy = nil
- 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
- 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")
- 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
- AutoShootButton.MouseButton1Click:Connect(function()
- AutoShootState = not AutoShootState
- AutoShootButton.Text = AutoShootState and "AutoShoot ON" or "AutoShoot OFF"
- if AutoShootState then
- startAutoShoot()
- end
- end)
- UIStroke_2.Parent = AutoShootFrame
- UIStroke_2.Thickness = 2
- UIStroke_2.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
- UIStroke_2.Color = Color3.fromRGB(255, 255, 255)
Add Comment
Please, Sign In to add comment