MaxproGlitcher

Gui Test ..

Aug 25th, 2024
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.33 KB | None | 0 0
  1.  
  2. local Players = game:GetService("Players")
  3. local RunService = game:GetService("RunService")
  4. local UserInputService = game:GetService("UserInputService")
  5. local GuiService = game:GetService("GuiService")
  6. local LocalPlayer = Players.LocalPlayer
  7.  
  8. -- Variables for functionality
  9. local camlockState = false
  10. local Prediction = 0.16
  11. local enemy = nil
  12.  
  13. -- Function to find the nearest enemy
  14. local function FindNearestEnemy()
  15. local closestDistance, closestPlayer = math.huge, nil
  16. local centerPosition = Vector2.new(GuiService:GetScreenResolution().X / 2, GuiService:GetScreenResolution().Y / 2)
  17. for _, player in ipairs(Players:GetPlayers()) do
  18. if player ~= LocalPlayer then
  19. local character = player.Character
  20. if character and character:FindFirstChild("HumanoidRootPart") and character.Humanoid.Health > 0 then
  21. local position, isVisibleOnViewport = workspace.CurrentCamera:WorldToViewportPoint(character.HumanoidRootPart.Position)
  22. if isVisibleOnViewport then
  23. local distance = (centerPosition - Vector2.new(position.X, position.Y)).Magnitude
  24. if distance < closestDistance then
  25. closestPlayer = character.HumanoidRootPart
  26. closestDistance = distance
  27. end
  28. end
  29. end
  30. end
  31. end
  32. return closestPlayer
  33. end
  34.  
  35. -- Function to aim the camera at the nearest enemy's HumanoidRootPart
  36. RunService.Heartbeat:Connect(function()
  37. if camlockState and enemy then
  38. if enemy.Parent and enemy.Parent:FindFirstChild("Humanoid") and enemy.Parent.Humanoid.Health > 0 then
  39. local camera = workspace.CurrentCamera
  40. camera.CFrame = CFrame.new(camera.CFrame.p, enemy.Position + enemy.Velocity * Prediction)
  41. else
  42. -- Re-acquire a new target
  43. enemy = FindNearestEnemy()
  44. end
  45. end
  46. end)
  47.  
  48. -- Screen GUI Setup
  49. local screenGui = Instance.new("ScreenGui")
  50. screenGui.ResetOnSpawn = false
  51. screenGui.Parent = LocalPlayer:WaitForChild("PlayerGui")
  52.  
  53. -- Function to create a rainbow effect for UIStroke
  54. local function createRainbowUIStroke(stroke)
  55. local hue = 0
  56. RunService.Heartbeat:Connect(function()
  57. hue = (hue + 1) % 360
  58. stroke.Color = Color3.fromHSV(hue / 360, 1, 1)
  59. end)
  60. end
  61.  
  62. -- Create the Game Info TextLabel (Bottom Left)
  63. local gameInfoLabel = Instance.new("TextLabel")
  64. gameInfoLabel.Size = UDim2.new(0, 200, 0, 60)
  65. gameInfoLabel.Position = UDim2.new(0, 10, 1, -70)
  66. gameInfoLabel.BackgroundColor3 = Color3.new(0, 0, 0)
  67. gameInfoLabel.BackgroundTransparency = 0.5
  68. gameInfoLabel.TextColor3 = Color3.new(1, 1, 1)
  69. gameInfoLabel.TextScaled = true
  70. gameInfoLabel.TextWrapped = true
  71. gameInfoLabel.Text = "Game Name: " .. game:GetService("MarketplaceService"):GetProductInfo(game.PlaceId).Name
  72. gameInfoLabel.Parent = screenGui
  73.  
  74. local gameInfoUICorner = Instance.new("UICorner")
  75. gameInfoUICorner.CornerRadius = UDim.new(0, 10)
  76. gameInfoUICorner.Parent = gameInfoLabel
  77.  
  78. local gameInfoUIStroke = Instance.new("UIStroke")
  79. gameInfoUIStroke.Thickness = 3
  80. gameInfoUIStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
  81. gameInfoUIStroke.Parent = gameInfoLabel
  82.  
  83. createRainbowUIStroke(gameInfoUIStroke)
  84.  
  85. -- Create the "Aimbot Toggle" Button (Above Game Info Label)
  86. local toggleButton = Instance.new("TextButton")
  87. toggleButton.Size = UDim2.new(0, 200, 0, 40)
  88. toggleButton.Position = UDim2.new(0, 10, 1, -120)
  89. toggleButton.BackgroundColor3 = Color3.new(0, 0, 0)
  90. toggleButton.BackgroundTransparency = 0.5
  91. toggleButton.TextColor3 = Color3.new(1, 1, 1)
  92. toggleButton.TextScaled = true
  93. toggleButton.TextWrapped = true
  94. toggleButton.Text = "Aimbot:OFF"
  95. toggleButton.Parent = screenGui
  96.  
  97. local toggleUICorner = Instance.new("UICorner")
  98. toggleUICorner.CornerRadius = UDim.new(0, 10)
  99. toggleUICorner.Parent = toggleButton
  100.  
  101. local toggleUIStroke = Instance.new("UIStroke")
  102. toggleUIStroke.Thickness = 3
  103. toggleUIStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
  104. toggleUIStroke.Parent = toggleButton
  105.  
  106. createRainbowUIStroke(toggleUIStroke)
  107.  
  108. -- Create the Username Label (Above Aimbot Button)
  109. local usernameLabel = Instance.new("TextLabel")
  110. usernameLabel.Size = UDim2.new(0, 200, 0, 40)
  111. usernameLabel.Position = UDim2.new(0, 10, 1, -170)
  112. usernameLabel.BackgroundColor3 = Color3.new(0, 0, 0)
  113. usernameLabel.BackgroundTransparency = 0.5
  114. usernameLabel.TextColor3 = Color3.new(1, 1, 1)
  115. usernameLabel.TextScaled = true
  116. usernameLabel.TextWrapped = true
  117. usernameLabel.Text = "Username: " .. LocalPlayer.Name
  118. usernameLabel.Parent = screenGui
  119.  
  120. local usernameUICorner = Instance.new("UICorner")
  121. usernameUICorner.CornerRadius = UDim.new(0, 10)
  122. usernameUICorner.Parent = usernameLabel
  123.  
  124. local usernameUIStroke = Instance.new("UIStroke")
  125. usernameUIStroke.Thickness = 3
  126. usernameUIStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
  127. usernameUIStroke.Parent = usernameLabel
  128.  
  129. createRainbowUIStroke(usernameUIStroke)
  130.  
  131. -- Create the Rainbow Outline Frame (Above Username Label)
  132. local rainbowFrame = Instance.new("Frame")
  133. rainbowFrame.Size = UDim2.new(0, 200, 0, 60)
  134. rainbowFrame.Position = UDim2.new(0, 10, 1, -230)
  135. rainbowFrame.BackgroundColor3 = Color3.new(0, 0, 0)
  136. rainbowFrame.BackgroundTransparency = 0.5
  137. rainbowFrame.Parent = screenGui
  138.  
  139. local rainbowFrameUICorner = Instance.new("UICorner")
  140. rainbowFrameUICorner.CornerRadius = UDim.new(0, 10)
  141. rainbowFrameUICorner.Parent = rainbowFrame
  142.  
  143. local rainbowFrameUIStroke = Instance.new("UIStroke")
  144. rainbowFrameUIStroke.Thickness = 3
  145. rainbowFrameUIStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
  146. rainbowFrameUIStroke.Parent = rainbowFrame
  147.  
  148. createRainbowUIStroke(rainbowFrameUIStroke)
  149.  
  150. -- Create FPS and Ping Labels (Inside the Rainbow Frame)
  151. local fpsLabel = Instance.new("TextLabel")
  152. fpsLabel.Size = UDim2.new(1, 0, 0.5, 0)
  153. fpsLabel.Position = UDim2.new(0, 0, 0, 0)
  154. fpsLabel.BackgroundTransparency = 1
  155. fpsLabel.TextColor3 = Color3.new(1, 1, 1)
  156. fpsLabel.TextScaled = true
  157. fpsLabel.TextWrapped = true
  158. fpsLabel.Text = "FPS: Calculating..."
  159. fpsLabel.Parent = rainbowFrame
  160.  
  161. local pingLabel = Instance.new("TextLabel")
  162. pingLabel.Size = UDim2.new(1, 0, 0.5, 0)
  163. pingLabel.Position = UDim2.new(0, 0, 0.5, 0)
  164. pingLabel.BackgroundTransparency = 1
  165. pingLabel.TextColor3 = Color3.new(1, 1, 1)
  166. pingLabel.TextScaled = true
  167. pingLabel.TextWrapped = true
  168. pingLabel.Text = "Ping: Calculating..."
  169. pingLabel.Parent = rainbowFrame
  170.  
  171. -- Function to update FPS and Ping
  172. local lastTime = tick()
  173. local frameCount = 0
  174.  
  175. local function updateFPSAndPing()
  176. RunService.Heartbeat:Connect(function()
  177. frameCount = frameCount + 1
  178. local currentTime = tick()
  179. if currentTime - lastTime >= 1 then
  180. local fps = frameCount / (currentTime - lastTime)
  181. fpsLabel.Text = string.format("FPS: %.0f", fps)
  182. lastTime = currentTime
  183. frameCount = 0
  184. end
  185.  
  186. local ping = game:GetService("Stats").Network.ServerStatsItem["Data Ping"]:GetValueString()
  187. pingLabel.Text = "Ping: " .. ping
  188. end)
  189. end
  190.  
  191. -- Initialize FPS and Ping updates
  192. updateFPSAndPing()
  193.  
  194. -- Toggle Aimbot Functionality
  195. local function toggleAimbot()
  196. camlockState = not camlockState
  197. if camlockState then
  198. enemy = FindNearestEnemy()
  199. toggleButton.Text = "Aimbot:ON"
  200. else
  201. toggleButton.Text = "Aimbot:OFF"
  202. enemy = nil
  203. end
  204. end
  205.  
  206. toggleButton.MouseButton1Click:Connect(toggleAimbot)
  207.  
  208. -- Handle Keybind for toggling camlock (T key)
  209. UserInputService.InputBegan:Connect(function(input, gameProcessed)
  210. if gameProcessed then return end
  211. if input.KeyCode == Enum.KeyCode.T then
  212. toggleAimbot()
  213. end
  214. end)
  215.  
  216. local Players = game:GetService("Players")
  217. local LocalPlayer = Players.LocalPlayer
  218. local RunService = game:GetService("RunService")
  219.  
  220. -- Function to create a rainbow effect for UIStroke
  221. local function createRainbowUIStroke(stroke)
  222. local hue = 0
  223. RunService.Heartbeat:Connect(function()
  224. hue = (hue + 1) % 360
  225. stroke.Color = Color3.fromHSV(hue / 360, 1, 1)
  226. end)
  227. end
  228.  
  229. -- Create a toggle button to show/hide the aimbot button and rainbow frame
  230. local toggleVisibilityButton = Instance.new("TextButton")
  231. toggleVisibilityButton.Size = UDim2.new(0, 100, 0, 30)
  232. toggleVisibilityButton.Position = UDim2.new(1, -110, 0, 10) -- Position it at the top right corner
  233. toggleVisibilityButton.BackgroundColor3 = Color3.new(0, 0, 0)
  234. toggleVisibilityButton.BackgroundTransparency = 0.5
  235. toggleVisibilityButton.TextColor3 = Color3.new(1, 1, 1)
  236. toggleVisibilityButton.TextScaled = true
  237. toggleVisibilityButton.TextWrapped = true
  238. toggleVisibilityButton.Text = "Minimize"
  239. toggleVisibilityButton.Parent = screenGui
  240.  
  241. -- Add UI corner
  242. local toggleVisibilityUICorner = Instance.new("UICorner")
  243. toggleVisibilityUICorner.CornerRadius = UDim.new(0, 10)
  244. toggleVisibilityUICorner.Parent = toggleVisibilityButton
  245.  
  246. -- Add rainbow outline
  247. local toggleVisibilityUIStroke = Instance.new("UIStroke")
  248. toggleVisibilityUIStroke.Thickness = 3
  249. toggleVisibilityUIStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
  250. toggleVisibilityUIStroke.Parent = toggleVisibilityButton
  251.  
  252. createRainbowUIStroke(toggleVisibilityUIStroke)
  253.  
  254. -- Function to toggle visibility of the aimbot button, rainbow frame, usernameLabel, and gameInfoLabel
  255. local function toggleVisibility()
  256. toggleButton.Visible = not toggleButton.Visible
  257. rainbowFrame.Visible = not rainbowFrame.Visible
  258. usernameLabel.Visible = not usernameLabel.Visible
  259. gameInfoLabel.Visible = not gameInfoLabel.Visible
  260. fpsLabel.Visible = not fpsLabel.Visible
  261. pingLabel.Visible = not pingLabel.Visible
  262.  
  263. toggleVisibilityButton.Text = toggleButton.Visible and "Minimize" or "Minimized"
  264. end
  265.  
  266. toggleVisibilityButton.MouseButton1Click:Connect(toggleVisibility)
  267.  
  268.  
  269. -- Services
  270. local Players = game:GetService("Players")
  271. local LocalPlayer = Players.LocalPlayer
  272.  
  273.  
  274. -- Handle player respawn to re-acquire target
  275. Players.PlayerAdded:Connect(function(player)
  276. player.CharacterAdded:Connect(function(character)
  277. if camlockState then
  278. enemy = FindNearestEnemy()
  279. end
  280. end)
  281. end)
  282.  
  283. -- Re-acquire the nearest enemy when other players respawn
  284. Players.PlayerRemoving:Connect(function(player)
  285. if player == enemy.Parent then
  286. enemy = FindNearestEnemy()
  287. end
  288. end)
  289.  
  290. -- Initialize the script
  291. enemy = FindNearestEnemy()
Advertisement
Add Comment
Please, Sign In to add comment