Advertisement
Eproq012

Ee

Sep 15th, 2024
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.63 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(game.Workspace.CurrentCamera.ViewportSize.X / 2, game.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 = game.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 (calculates based on ping)
  36. local function UpdatePrediction()
  37. local ping = Stats.Network.ServerStatsItem["Data Ping"]:GetValue() -- Get current ping
  38. if ping < 50 then
  39. Prediction = 0.1 -- Low ping, less prediction needed
  40. elseif ping < 100 then
  41. Prediction = 0.15 -- Mid ping
  42. elseif ping < 200 then
  43. Prediction = 0.2 -- High ping
  44. else
  45. Prediction = 0.25 -- Very high ping, larger prediction
  46. end
  47. end
  48.  
  49. -- Function to aim the camera at the nearest enemy's HumanoidRootPart with auto prediction
  50. RunService.Heartbeat:Connect(function()
  51. if CamlockState == true then
  52. if currentTarget then
  53. local camera = workspace.CurrentCamera
  54. -- Predict the target's position and adjust the camera to look at it
  55. camera.CFrame = CFrame.new(camera.CFrame.Position, currentTarget.Position + currentTarget.Velocity * Prediction)
  56. end
  57. end
  58. end)
  59.  
  60. -- Continuously update prediction based on ping
  61. RunService.Heartbeat:Connect(function()
  62. UpdatePrediction() -- Auto-update prediction every frame based on current ping
  63. end)
  64.  
  65. -- Toggle the camlock when a target is locked
  66. UserInputService.InputBegan:Connect(function(input, gameProcessed)
  67. if gameProcessed then return end -- Ignore input if the game is using the input
  68.  
  69. if input.KeyCode == Enum.KeyCode.Q then
  70. CamlockState = not CamlockState
  71. if CamlockState then
  72. currentTarget = FindNearestEnemy() -- Lock onto the nearest enemy
  73. else
  74. -- Disable Camlock
  75. currentTarget = nil
  76. end
  77. end
  78. end)
  79.  
  80. -- PURIFY UI Setup (for controlling Camlock)
  81. local PURIFY = Instance.new("ScreenGui")
  82. local Frame = Instance.new("Frame")
  83. local UICorner = Instance.new("UICorner")
  84. local TextButton = Instance.new("TextButton")
  85. local UICorner_2 = Instance.new("UICorner")
  86. local UIStroke = Instance.new("UIStroke")
  87.  
  88. -- Properties
  89. PURIFY.Name = "PURIFY"
  90. PURIFY.Parent = game.CoreGui
  91. PURIFY.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  92.  
  93. Frame.Parent = PURIFY
  94. Frame.BackgroundColor3 = Color3.fromRGB(0, 0, 0) -- Pure black for a sleek look
  95. Frame.BorderColor3 = Color3.fromRGB(0, 0, 0)
  96. Frame.BorderSizePixel = 0
  97. Frame.Position = UDim2.new(0.133798108, 0, 0.20107238, 0)
  98. Frame.Size = UDim2.new(0, 202, 0, 70)
  99. Frame.Active = true
  100. Frame.Draggable = true
  101.  
  102. UICorner.Parent = Frame
  103.  
  104. TextButton.Parent = Frame
  105. TextButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  106. TextButton.BackgroundTransparency = 5.000
  107. TextButton.BorderColor3 = Color3.fromRGB(0, 0, 0)
  108. TextButton.BorderSizePixel = 0
  109. TextButton.Position = UDim2.new(0.0792079195, 0, 0.18571429, 0)
  110. TextButton.Size = UDim2.new(0, 170, 0, 44)
  111. TextButton.Font = Enum.Font.SourceSansSemibold
  112. TextButton.Text = "PURIFY OFF" -- Initial text when Camlock is off
  113. TextButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  114. TextButton.TextScaled = true
  115. TextButton.TextSize = 11.000
  116. TextButton.TextWrapped = true
  117.  
  118. -- Add UIStroke for sea-blue gradient effect
  119. UIStroke.Parent = Frame
  120. UIStroke.Thickness = 2
  121. UIStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
  122. UIStroke.Color = Color3.fromRGB(0, 255, 255) -- Initial sea blue color
  123.  
  124. UICorner_2.Parent = TextButton
  125.  
  126. -- Toggle the camlock and PURIFY mode on button click
  127. TextButton.MouseButton1Click:Connect(function()
  128. CamlockState = not CamlockState
  129. TextButton.Text = CamlockState and "PURIFY ON" or "PURIFY OFF" -- Toggle between ON and OFF
  130. if CamlockState then
  131. currentTarget = FindNearestEnemy()
  132. else
  133. currentTarget = nil
  134. end
  135. end)
  136.  
  137. -- Create an ocean-blue rainbow effect for the button and the frame
  138. spawn(function()
  139. local hue = 180
  140. while true do
  141. -- Calculate the current color in the blue range (hue 180-240)
  142. local color = Color3.fromHSV(hue / 360, 0.8, 1)
  143.  
  144. -- Apply the color to the text and stroke
  145. TextButton.TextColor3 = color
  146. UIStroke.Color = color
  147.  
  148. -- Increment the hue for the rainbow effect
  149. hue = hue + 1
  150. if hue > 240 then
  151. hue = 180 -- Reset to start of ocean blue
  152. end
  153.  
  154. wait(0.05) -- Controls how fast the rainbow effect changes
  155. end
  156. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement