Advertisement
Eproq012

Untitled

Sep 15th, 2024
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.27 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local RunService = game:GetService("RunService")
  3. local UserInputService = game:GetService("UserInputService")
  4. local Stats = game:GetService("Stats")
  5. local LocalPlayer = Players.LocalPlayer
  6. local CamlockState = false
  7. local Prediction = 0.16289702
  8. local ESPBillboard = nil
  9. local currentTarget = nil
  10.  
  11. -- Function to find the nearest enemy
  12. function FindNearestEnemy()
  13. local ClosestDistance, ClosestPlayer = math.huge, nil
  14. local CenterPosition = Vector2.new(workspace.CurrentCamera.ViewportSize.X / 2, workspace.CurrentCamera.ViewportSize.Y / 2)
  15.  
  16. for _, Player in ipairs(Players:GetPlayers()) do
  17. if Player ~= LocalPlayer then
  18. local Character = Player.Character
  19. if Character and Character:FindFirstChild("HumanoidRootPart") and Character.Humanoid.Health > 0 then
  20. local Position, IsVisibleOnViewport = workspace.CurrentCamera:WorldToViewportPoint(Character.HumanoidRootPart.Position)
  21. if IsVisibleOnViewport then
  22. local Distance = (CenterPosition - Vector2.new(Position.X, Position.Y)).Magnitude
  23. if Distance < ClosestDistance then
  24. ClosestPlayer = Character.HumanoidRootPart
  25. ClosestDistance = Distance
  26. end
  27. end
  28. end
  29. end
  30. end
  31.  
  32. return ClosestPlayer
  33. end
  34.  
  35. -- Auto Prediction Function (based on custom ping ranges)
  36. local function UpdatePrediction()
  37. local ping = Stats.Network.ServerStatsItem["Data Ping"]:GetValue() -- Get current ping
  38.  
  39. -- Auto Prediction Function (based on custom ping ranges)
  40. local function UpdatePrediction()
  41. local ping = Stats.Network.ServerStatsItem["Data Ping"]:GetValue() -- Get current ping
  42.  
  43. -- Custom Ping-Based Prediction Values
  44. if ping >= 300 and ping <= 350 then
  45. Prediction = 0.3 -- Very high ping (300-350), large prediction
  46. elseif ping >= 230 and ping < 300 then
  47. Prediction = 0.25 -- High ping (230-300), large prediction
  48. elseif ping >= 180 and ping < 230 then
  49. Prediction = 0.22 -- High ping (180-230)
  50. elseif ping >= 120 and ping < 180 then
  51. Prediction = 0.18 -- Medium-high ping (120-180)
  52. elseif ping >= 100 and ping < 120 then
  53. Prediction = 0.124874 -- Custom ping (100-120)
  54. elseif ping >= 90 and ping < 100 then
  55. Prediction = 0.12 -- Medium ping (90-100), lower prediction
  56. else
  57. Prediction = 0.16289702 -- Default prediction for other ping ranges
  58. end
  59. end
  60.  
  61. -- Function to aim the camera at the nearest enemy's HumanoidRootPart with auto prediction
  62. RunService.Heartbeat:Connect(function()
  63. if CamlockState == true then
  64. if currentTarget then
  65. local camera = workspace.CurrentCamera
  66. -- Predict the target's position and adjust the camera to look at it
  67. camera.CFrame = CFrame.new(camera.CFrame.Position, currentTarget.Position + currentTarget.Velocity * Prediction)
  68. end
  69. end
  70. end)
  71.  
  72. -- Continuously update prediction based on ping
  73. RunService.Heartbeat:Connect(function()
  74. UpdatePrediction() -- Auto-update prediction every frame based on current ping
  75. end)
  76.  
  77. -- Toggle the camlock when a target is locked
  78. UserInputService.InputBegan:Connect(function(input, gameProcessed)
  79. if gameProcessed then return end -- Ignore input if the game is using the input
  80.  
  81. if input.KeyCode == Enum.KeyCode.Q then
  82. CamlockState = not CamlockState
  83. if CamlockState then
  84. currentTarget = FindNearestEnemy() -- Lock onto the nearest enemy
  85. else
  86. -- Disable Camlock
  87. currentTarget = nil
  88. end
  89. end
  90. end)
  91.  
  92. -- PURIFY UI Setup (for controlling Camlock)
  93. local PURIFY = Instance.new("ScreenGui")
  94. local Frame = Instance.new("Frame")
  95. local UICorner = Instance.new("UICorner")
  96. local TextButton = Instance.new("TextButton")
  97. local UICorner_2 = Instance.new("UICorner")
  98. local UIStroke = Instance.new("UIStroke")
  99.  
  100. -- Properties
  101. PURIFY.Name = "PURIFY"
  102. PURIFY.Parent = game.CoreGui
  103. PURIFY.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  104.  
  105. Frame.Parent = PURIFY
  106. Frame.BackgroundColor3 = Color3.fromRGB(0, 0, 0) -- Pure black for a sleek look
  107. Frame.BorderColor3 = Color3.fromRGB(0, 0, 0)
  108. Frame.BorderSizePixel = 0
  109. Frame.Position = UDim2.new(0.133798108, 0, 0.20107238, 0)
  110. Frame.Size = UDim2.new(0, 202, 0, 70)
  111. Frame.Active = true
  112. Frame.Draggable = true
  113.  
  114. UICorner.Parent = Frame
  115.  
  116. TextButton.Parent = Frame
  117. TextButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  118. TextButton.BackgroundTransparency = 5.000
  119. TextButton.BorderColor3 = Color3.fromRGB(0, 0, 0)
  120. TextButton.BorderSizePixel = 0
  121. TextButton.Position = UDim2.new(0.0792079195, 0, 0.18571429, 0)
  122. TextButton.Size = UDim2.new(0, 170, 0, 44)
  123. TextButton.Font = Enum.Font.SourceSansSemibold
  124. TextButton.Text = "PURIFY OFF" -- Initial text when Camlock is off
  125. TextButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  126. TextButton.TextScaled = true
  127. TextButton.TextSize = 11.000
  128. TextButton.TextWrapped = true
  129.  
  130. -- Add UIStroke for sea-blue gradient effect
  131. UIStroke.Parent = Frame
  132. UIStroke.Thickness = 2
  133. UIStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
  134. UIStroke.Color = Color3.fromRGB(0, 255, 255) -- Initial sea blue color
  135.  
  136. UICorner_2.Parent = TextButton
  137.  
  138. -- Toggle the camlock and PURIFY mode on button click
  139. TextButton.MouseButton1Click:Connect(function()
  140. CamlockState = not CamlockState
  141. TextButton.Text = CamlockState and "PURIFY ON" or "PURIFY OFF" -- Toggle between ON and OFF
  142. if CamlockState then
  143. currentTarget = FindNearestEnemy()
  144. else
  145. currentTarget = nil
  146. end
  147. end)
  148.  
  149. -- Create an ocean-blue rainbow effect for the button and the frame
  150. spawn(function()
  151. local hue = 180
  152. while true do
  153. -- Calculate the current color in the blue range (hue 180-240)
  154. local color = Color3.fromHSV(hue / 360, 0.8, 1)
  155.  
  156. -- Apply the color to the text and stroke
  157. TextButton.TextColor3 = color
  158. UIStroke.Color = color
  159.  
  160. -- Increment the hue for the rainbow effect
  161. hue = hue + 1
  162. if hue > 240 then
  163. hue = 180 -- Reset to start of ocean blue
  164. end
  165.  
  166. wait(0.05) -- Controls how fast the rainbow effect changes
  167. end
  168. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement