Advertisement
Eproq012

Purify

Sep 14th, 2024
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.14 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local RunService = game:GetService("RunService")
  3. local UserInputService = game:GetService("UserInputService")
  4. local LocalPlayer = Players.LocalPlayer
  5. local Mouse = LocalPlayer:GetMouse()
  6. local CamlockState = false
  7. local Prediction = 0.1299222231
  8.  
  9. -- Function to find the nearest enemy
  10. function FindNearestEnemy()
  11. local ClosestDistance, ClosestPlayer = math.huge, nil
  12. local CenterPosition = Vector2.new(game:GetService("GuiService"):GetScreenResolution().X / 2, game:GetService("GuiService"):GetScreenResolution().Y / 2)
  13.  
  14. for _, Player in ipairs(game:GetService("Players"):GetPlayers()) do
  15. if Player ~= LocalPlayer then
  16. local Character = Player.Character
  17. if Character and Character:FindFirstChild("HumanoidRootPart") and Character.Humanoid.Health > 0 then
  18. local Position, IsVisibleOnViewport = game:GetService("Workspace").CurrentCamera:WorldToViewportPoint(Character.HumanoidRootPart.Position)
  19. if IsVisibleOnViewport then
  20. local Distance = (CenterPosition - Vector2.new(Position.X, Position.Y)).Magnitude
  21. if Distance < ClosestDistance then
  22. ClosestPlayer = Character.HumanoidRootPart
  23. ClosestDistance = Distance
  24. end
  25. end
  26. end
  27. end
  28. end
  29.  
  30. return ClosestPlayer
  31. end
  32.  
  33. local enemy = nil
  34.  
  35. -- Function to aim the camera at the nearest enemy's HumanoidRootPart
  36. RunService.Heartbeat:Connect(function()
  37. if CamlockState == true then
  38. if enemy then
  39. local camera = workspace.CurrentCamera
  40. -- Use a single prediction value to anticipate enemy movement
  41. camera.CFrame = CFrame.new(camera.CFrame.p, enemy.Position + enemy.Velocity * Prediction)
  42. end
  43. end
  44. end)
  45.  
  46. -- PURIFY UI Setup
  47. local PURIFY = Instance.new("ScreenGui")
  48. local Frame = Instance.new("Frame")
  49. local UICorner = Instance.new("UICorner")
  50. local TextButton = Instance.new("TextButton")
  51. local UICorner_2 = Instance.new("UICorner")
  52. local UIStroke = Instance.new("UIStroke")
  53.  
  54. -- Properties
  55. PURIFY.Name = "PURIFY"
  56. PURIFY.Parent = game.CoreGui
  57. PURIFY.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  58.  
  59. Frame.Parent = PURIFY
  60. Frame.BackgroundColor3 = Color3.fromRGB(0, 0, 0) -- Pure black for a sleek look
  61. Frame.BorderColor3 = Color3.fromRGB(0, 0, 0)
  62. Frame.BorderSizePixel = 0
  63. Frame.Position = UDim2.new(0.133798108, 0, 0.20107238, 0)
  64. Frame.Size = UDim2.new(0, 202, 0, 70)
  65. Frame.Active = true
  66. Frame.Draggable = true
  67.  
  68. -- Ensure the frame stays centered on the screen
  69. local function TopContainer()
  70. Frame.Position = UDim2.new(0.5, -Frame.AbsoluteSize.X / 2, 0, -Frame.AbsoluteSize.Y / 2)
  71. end
  72.  
  73. TopContainer()
  74. Frame:GetPropertyChangedSignal("AbsoluteSize"):Connect(TopContainer)
  75.  
  76. UICorner.Parent = Frame
  77.  
  78. TextButton.Parent = Frame
  79. TextButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  80. TextButton.BackgroundTransparency = 5.000
  81. TextButton.BorderColor3 = Color3.fromRGB(0, 0, 0)
  82. TextButton.BorderSizePixel = 0
  83. TextButton.Position = UDim2.new(0.0792079195, 0, 0.18571429, 0)
  84. TextButton.Size = UDim2.new(0, 170, 0, 44)
  85. TextButton.Font = Enum.Font.SourceSansSemibold
  86. TextButton.Text = "PURIFY OFF" -- Changed text to match PURIFY mode
  87. TextButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  88. TextButton.TextScaled = true
  89. TextButton.TextSize = 11.000
  90. TextButton.TextWrapped = true
  91.  
  92. -- Add UIStroke for sea-blue gradient effect
  93. UIStroke.Parent = Frame
  94. UIStroke.Thickness = 2
  95. UIStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
  96. UIStroke.Color = Color3.fromRGB(0, 255, 255) -- Initial sea blue color
  97.  
  98. -- Function to create a gradient sea-blue effect
  99. local function SeaBlueGradientEffect()
  100. local hue = 180 -- Start at a sea-blue hue
  101. while true do
  102. -- Transition between light blue and deep sea blue colors
  103. local color = Color3.fromHSV(hue / 360, 0.8, 1) -- Saturation and brightness set to give a more sea-like look
  104. UIStroke.Color = color
  105. TextButton.TextColor3 = color
  106. -- Slow the transition down for a smoother effect
  107. hue = (hue - 1) % 360
  108. if hue < 180 then hue = 240 end -- Cycle between 180 (light blue) and 240 (deeper blue)
  109. wait(0.05)
  110. end
  111. end
  112.  
  113. -- Start the sea-blue gradient effect
  114. spawn(SeaBlueGradientEffect)
  115.  
  116. -- Toggle the camlock and PURIFY mode on button click
  117. TextButton.MouseButton1Click:Connect(function()
  118. CamlockState = not CamlockState
  119. TextButton.Text = CamlockState and "PURIFY ON" or "PURIFY OFF" -- Toggle between ON and OFF
  120. enemy = CamlockState and FindNearestEnemy() or nil
  121. end)
  122.  
  123. UICorner_2.Parent = TextButton
  124.  
  125. -- Listen for the "Q" key press to toggle camlock
  126. UserInputService.InputBegan:Connect(function(input, gameProcessed)
  127. if gameProcessed then return end -- Ignore input if it's being used by something else
  128.  
  129. if input.KeyCode == Enum.KeyCode.Q then
  130. CamlockState = not CamlockState
  131. TextButton.Text = CamlockState and "PURIFY ON" or "PURIFY OFF" -- Toggle between ON and OFF
  132. enemy = CamlockState and FindNearestEnemy() or nil
  133. end
  134. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement