Advertisement
Eproq012

305ej

Oct 11th, 2024
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.11 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local RunService = game:GetService("RunService")
  3. local LocalPlayer = Players.LocalPlayer
  4. local Mouse = LocalPlayer:GetMouse()
  5.  
  6. local CamlockState = false
  7. local AutoShootState = false
  8. local clickInterval = 0.5
  9. local Prediction = 0.1457102
  10. local HorizontalPrediction = 0.16458
  11. local VerticalPrediction = 0.1422
  12. local enemy = nil
  13. local Minimized = false
  14.  
  15. getgenv().Key = "q"
  16.  
  17. function FindNearestEnemy()
  18. local ClosestDistance, ClosestPlayer = math.huge, nil
  19. local CenterPosition = Vector2.new(
  20. game:GetService("GuiService"):GetScreenResolution().X / 2,
  21. game:GetService("GuiService"):GetScreenResolution().Y / 2
  22. )
  23.  
  24. for _, Player in ipairs(Players:GetPlayers()) do
  25. if Player ~= LocalPlayer then
  26. local Character = Player.Character
  27. if Character and Character:FindFirstChild("HumanoidRootPart") and Character.Humanoid.Health > 0 then
  28. local Position, IsVisibleOnViewport = workspace.CurrentCamera:WorldToViewportPoint(Character.HumanoidRootPart.Position)
  29.  
  30. if IsVisibleOnViewport then
  31. local Distance = (CenterPosition - Vector2.new(Position.X, Position.Y)).Magnitude
  32. if Distance < ClosestDistance then
  33. ClosestPlayer = Character.HumanoidRootPart
  34. ClosestDistance = Distance
  35. end
  36. end
  37. end
  38. end
  39. end
  40.  
  41. return ClosestPlayer
  42. end
  43.  
  44. RunService.Heartbeat:Connect(function()
  45. if CamlockState and enemy then
  46. local camera = workspace.CurrentCamera
  47. local predictedPosition = enemy.Position + Vector3.new(
  48. enemy.Velocity.X * HorizontalPrediction,
  49. enemy.Velocity.Y * VerticalPrediction,
  50. enemy.Velocity.Z * Prediction
  51. )
  52. camera.CFrame = CFrame.new(camera.CFrame.p, predictedPosition)
  53. end
  54. end)
  55.  
  56. local function autoShoot()
  57. local tool = LocalPlayer.Character:FindFirstChildOfClass("Tool")
  58. if tool and tool:FindFirstChild("Handle") and enemy then
  59. local ray = Ray.new(LocalPlayer.Character.Head.Position, (enemy.Position - LocalPlayer.Character.Head.Position).unit * 500)
  60. local hitPart, hitPosition = workspace:FindPartOnRay(ray, LocalPlayer.Character)
  61. if hitPart and hitPart:IsDescendantOf(enemy.Parent) then
  62. tool:Activate()
  63. end
  64. end
  65. end
  66.  
  67. local function startAutoShoot()
  68. while AutoShootState do
  69. autoShoot()
  70. wait(clickInterval)
  71. end
  72. end
  73.  
  74. local function createButton(text, parent, size, pos)
  75. local button = Instance.new("TextButton")
  76. button.Parent = parent
  77. button.Text = text
  78. button.Size = size
  79. button.Position = pos
  80. button.BackgroundColor3 = Color3.fromRGB(255, 85, 85)
  81. button.TextColor3 = Color3.fromRGB(255, 255, 255)
  82. button.Font = Enum.Font.GothamBold
  83. button.TextScaled = true
  84. button.TextWrapped = true
  85. button.BorderSizePixel = 0
  86.  
  87. local corner = Instance.new("UICorner")
  88. corner.CornerRadius = UDim.new(0, 10)
  89. corner.Parent = button
  90.  
  91. return button
  92. end
  93.  
  94. local function createMinimizeButton(parent, position)
  95. local button = createButton("-", parent, UDim2.new(0, 20, 0, 20), position)
  96. button.Text = "-"
  97. button.BackgroundColor3 = Color3.fromRGB(255, 85, 85)
  98. return button
  99. end
  100.  
  101. local function createCloseButton(parent, position)
  102. local button = createButton("X", parent, UDim2.new(0, 20, 0, 20), position)
  103. button.Text = "X"
  104. button.BackgroundColor3 = Color3.fromRGB(255, 85, 85)
  105. return button
  106. end
  107.  
  108. local CamLockGui = Instance.new("ScreenGui")
  109. local CamLockFrame = Instance.new("Frame")
  110. local UICornerCamLock = Instance.new("UICorner")
  111.  
  112. CamLockGui.Name = "CamLockGui"
  113. CamLockGui.Parent = game.CoreGui
  114.  
  115. CamLockFrame.Parent = CamLockGui
  116. CamLockFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
  117. CamLockFrame.BorderSizePixel = 0
  118. CamLockFrame.Position = UDim2.new(1, -240, 0, 10)
  119. CamLockFrame.Size = UDim2.new(0, 202, 0, 100)
  120. CamLockFrame.Active = true
  121. CamLockFrame.Draggable = true
  122.  
  123. UICornerCamLock.CornerRadius = UDim.new(0, 10)
  124. UICornerCamLock.Parent = CamLockFrame
  125.  
  126. local CamLockTitleLabel = Instance.new("TextLabel")
  127. CamLockTitleLabel.Parent = CamLockFrame
  128. CamLockTitleLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  129. CamLockTitleLabel.BackgroundTransparency = 1
  130. CamLockTitleLabel.Position = UDim2.new(0, -10, 0, 3)
  131. CamLockTitleLabel.Size = UDim2.new(1, 0, 0, 30)
  132. CamLockTitleLabel.Font = Enum.Font.GothamBold
  133. CamLockTitleLabel.Text = "CamLock"
  134. CamLockTitleLabel.TextColor3 = Color3.fromRGB(255, 85, 85)
  135. CamLockTitleLabel.TextSize = 24
  136. CamLockTitleLabel.TextScaled = true
  137.  
  138. local CamLockButton = createButton("Toggle CamLock", CamLockFrame, UDim2.new(0, 170, 0, 44), UDim2.new(0.1, 0, 0.4, 0))
  139. CamLockButton.MouseButton1Click:Connect(function()
  140. CamlockState = not CamlockState
  141. if CamlockState then
  142. CamLockButton.Text = "CamLock ON"
  143. enemy = FindNearestEnemy()
  144. else
  145. CamLockButton.Text = "CamLock OFF"
  146. enemy = nil
  147. end
  148. end)
  149.  
  150. local MinimizeCamLockButton = createMinimizeButton(CamLockFrame, UDim2.new(0.9, -30, 0, 5))
  151. local CloseCamLockButton = createCloseButton(CamLockFrame, UDim2.new(0.9, -60, 0, 5))
  152.  
  153. CloseCamLockButton.MouseButton1Click:Connect(function()
  154. CamLockGui:Destroy()
  155. end)
  156.  
  157. MinimizeCamLockButton.MouseButton1Click:Connect(function()
  158. Minimized = not Minimized
  159. if Minimized then
  160. CamLockFrame.Size = UDim2.new(0, 100, 0, 40)
  161. CamLockTitleLabel.Visible = false
  162. CamLockButton.Visible = false
  163. MinimizeCamLockButton.Text = "+"
  164. else
  165. CamLockFrame.Size = UDim2.new(0, 202, 0, 100)
  166. CamLockTitleLabel.Visible = true
  167. CamLockButton.Visible = true
  168. MinimizeCamLockButton.Text = "-"
  169. end
  170. end)
  171.  
  172. local AutoShootGui = Instance.new("ScreenGui")
  173. local AutoShootFrame = Instance.new("Frame")
  174. local UICornerAutoShoot = Instance.new("UICorner")
  175.  
  176. AutoShootGui.Name = "AutoShootGui"
  177. AutoShootGui.Parent = game.CoreGui
  178.  
  179. AutoShootFrame.Parent = AutoShootGui
  180. AutoShootFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
  181. AutoShootFrame.BorderSizePixel = 0
  182. AutoShootFrame.Position = UDim2.new(1, -240, 0, 150)
  183. AutoShootFrame.Size = UDim2.new(0, 202, 0, 100)
  184. AutoShootFrame.Active = true
  185. AutoShootFrame.Draggable = true
  186.  
  187. UICornerAutoShoot.CornerRadius = UDim.new(0, 10)
  188. UICornerAutoShoot.Parent = AutoShootFrame
  189.  
  190. local AutoShootTitleLabel = Instance.new("TextLabel")
  191. AutoShootTitleLabel.Parent = AutoShootFrame
  192. AutoShootTitleLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  193. AutoShootTitleLabel.BackgroundTransparency = 1
  194. AutoShootTitleLabel.Position = UDim2.new(0, -10, 0, 3)
  195. AutoShootTitleLabel.Size = UDim2.new(1, 0, 0, 30)
  196. AutoShootTitleLabel.Font = Enum.Font.GothamBold
  197. AutoShootTitleLabel.Text = "AutoShoot"
  198. AutoShootTitleLabel.TextColor3 = Color3.fromRGB(255, 85, 85)
  199. AutoShootTitleLabel.TextSize = 24
  200. AutoShootTitleLabel.TextScaled = true
  201.  
  202. local AutoShootButton = createButton("Toggle AutoShoot", AutoShootFrame, UDim2.new(0, 170, 0, 44), UDim2.new(0.1, 0, 0.4, 0))
  203. AutoShootButton.MouseButton1Click:Connect(function()
  204. AutoShootState = not AutoShootState
  205. if AutoShootState then
  206. AutoShootButton.Text = "AutoShoot ON"
  207. spawn(startAutoShoot)
  208. else
  209. AutoShootButton.Text = "AutoShoot OFF"
  210. end
  211. end)
  212.  
  213. local MinimizeAutoShootButton = createMinimizeButton(AutoShootFrame, UDim2.new(0.9, -30, 0, 5))
  214. local CloseAutoShootButton = createCloseAutoShootButton.MouseButton1Click:Connect(function()
  215. AutoShootGui:Destroy()
  216. end)
  217.  
  218. MinimizeAutoShootButton.MouseButton1Click:Connect(function()
  219. Minimized = not Minimized
  220. if Minimized then
  221. AutoShootFrame.Size = UDim2.new(0, 100, 0, 40)
  222. AutoShootTitleLabel.Visible = false
  223. AutoShootButton.Visible = false
  224. MinimizeAutoShootButton.Text = "+"
  225. else
  226. AutoShootFrame.Size = UDim2.new(0, 202, 0, 100)
  227. AutoShootTitleLabel.Visible = true
  228. AutoShootButton.Visible = true
  229. MinimizeAutoShootButton.Text = "-"
  230. end
  231. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement