Advertisement
m9aari

hoop central 6 gui

Jun 28th, 2024
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.59 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local RunService = game:GetService("RunService")
  3. local UserInputService = game:GetService("UserInputService")
  4. local VirtualInputManager = game:GetService("VirtualInputManager")
  5. local TweenService = game:GetService("TweenService")
  6.  
  7. local correctKey = "blurdowashere21"
  8. local speed = 200 -- Speed in studs per second
  9.  
  10. -- Create ScreenGui
  11. local screenGui = Instance.new("ScreenGui")
  12. screenGui.Parent = Players.LocalPlayer:WaitForChild("PlayerGui")
  13. screenGui.ResetOnSpawn = false
  14.  
  15. -- Create the "Enter Key" frame
  16. local enterKeyFrame = Instance.new("Frame")
  17. enterKeyFrame.Size = UDim2.new(0, 400, 0, 200)
  18. enterKeyFrame.Position = UDim2.new(0.5, -200, 0.5, -100)
  19. enterKeyFrame.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)
  20. enterKeyFrame.Active = true
  21. enterKeyFrame.Draggable = true
  22. enterKeyFrame.Visible = true
  23. enterKeyFrame.Parent = screenGui
  24.  
  25. -- Create the frame title
  26. local enterKeyTitle = Instance.new("TextLabel")
  27. enterKeyTitle.Size = UDim2.new(1, 0, 0, 50)
  28. enterKeyTitle.Position = UDim2.new(0, 0, 0, 0)
  29. enterKeyTitle.Text = "Enter Key"
  30. enterKeyTitle.TextColor3 = Color3.new(1, 1, 1)
  31. enterKeyTitle.BackgroundTransparency = 1
  32. enterKeyTitle.Font = Enum.Font.SourceSansBold
  33. enterKeyTitle.TextSize = 36
  34. enterKeyTitle.Parent = enterKeyFrame
  35.  
  36. -- Create the TextBox for entering the key
  37. local keyTextBox = Instance.new("TextBox")
  38. keyTextBox.Size = UDim2.new(0, 300, 0, 50)
  39. keyTextBox.Position = UDim2.new(0.5, -150, 0.5, -25)
  40. keyTextBox.Text = ""
  41. keyTextBox.PlaceholderText = "Enter Key"
  42. keyTextBox.TextColor3 = Color3.new(1, 1, 1)
  43. keyTextBox.Font = Enum.Font.SourceSansBold
  44. keyTextBox.TextSize = 18
  45. keyTextBox.BackgroundTransparency = 0.5
  46. keyTextBox.BackgroundColor3 = Color3.new(0, 0, 0)
  47. keyTextBox.Parent = enterKeyFrame
  48.  
  49. -- Create the "Enter" button
  50. local enterButton = Instance.new("TextButton")
  51. enterButton.Size = UDim2.new(0, 150, 0, 50)
  52. enterButton.Position = UDim2.new(0.5, -75, 0.75, -25)
  53. enterButton.Text = "Enter"
  54. enterButton.TextColor3 = Color3.new(1, 1, 1)
  55. enterButton.Font = Enum.Font.SourceSansBold
  56. enterButton.TextSize = 18
  57. enterButton.BackgroundTransparency = 0.5
  58. enterButton.BackgroundColor3 = Color3.new(0, 0, 0)
  59. enterButton.Parent = enterKeyFrame
  60.  
  61. -- Create the main frame (hidden initially)
  62. local mainFrame = Instance.new("Frame")
  63. mainFrame.Size = UDim2.new(0, 400, 0, 400)
  64. mainFrame.Position = UDim2.new(0.5, -200, 0.5, -200)
  65. mainFrame.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)
  66. mainFrame.Active = true
  67. mainFrame.Draggable = true
  68. mainFrame.Visible = false
  69. mainFrame.Parent = screenGui
  70.  
  71. -- Create the frame title
  72. local title = Instance.new("TextLabel")
  73. title.Size = UDim2.new(1, 0, 0, 50)
  74. title.Position = UDim2.new(0, 0, 0, 0)
  75. title.Text = "Mari's Hoop Central 6 Gui"
  76. title.TextColor3 = Color3.new(1, 1, 1)
  77. title.BackgroundTransparency = 1
  78. title.Font = Enum.Font.SourceSansBold
  79. title.TextSize = 36
  80. title.Parent = mainFrame
  81.  
  82. -- Create the "Click to Orbit" button
  83. local orbitButton = Instance.new("TextButton")
  84. orbitButton.Size = UDim2.new(0, 150, 0, 50)
  85. orbitButton.Position = UDim2.new(0.05, 0, 0.3, -25)
  86. orbitButton.Text = "Auto Guard"
  87. orbitButton.TextColor3 = Color3.new(1, 1, 1)
  88. orbitButton.Font = Enum.Font.SourceSansBold
  89. orbitButton.TextSize = 18
  90. orbitButton.BackgroundTransparency = 0.5
  91. orbitButton.BackgroundColor3 = Color3.new(0, 0, 0)
  92. orbitButton.Parent = mainFrame
  93.  
  94. local orbiting = false
  95. local targetPlayer = nil
  96. local distanceInFront = 2.5
  97.  
  98. -- Function to toggle the orbiting state
  99. local function toggleOrbiting()
  100. orbiting = not orbiting
  101. if orbiting then
  102. orbitButton.Text = "Stop Auto Guarding"
  103. orbitButton.BackgroundColor3 = Color3.new(0, 1, 0)
  104. VirtualInputManager:SendKeyEvent(true, Enum.KeyCode.G, false, game)
  105. else
  106. orbitButton.Text = "Auto Guard"
  107. orbitButton.BackgroundColor3 = Color3.new(0, 0, 0)
  108. targetPlayer = nil
  109. VirtualInputManager:SendKeyEvent(false, Enum.KeyCode.G, false, game)
  110. end
  111. end
  112.  
  113. -- Function to find the player character that is clicked
  114. local function getClickedPlayer(mousePos)
  115. local camera = workspace.CurrentCamera
  116. local unitRay = camera:ScreenPointToRay(mousePos.X, mousePos.Y)
  117. local ray = Ray.new(unitRay.Origin, unitRay.Direction * 1000)
  118.  
  119. local part, position = workspace:FindPartOnRay(ray, Players.LocalPlayer.Character)
  120.  
  121. if part then
  122. local clickedPlayer = Players:GetPlayerFromCharacter(part.Parent)
  123. return clickedPlayer
  124. end
  125.  
  126. return nil
  127. end
  128.  
  129. -- Function to handle mouse clicks
  130. local function onMouseClick()
  131. if orbiting then
  132. local mousePos = UserInputService:GetMouseLocation()
  133. local player = getClickedPlayer(mousePos)
  134.  
  135. if player then
  136. targetPlayer = player
  137. end
  138. end
  139. end
  140.  
  141. -- Connect the button click event
  142. orbitButton.MouseButton1Click:Connect(toggleOrbiting)
  143.  
  144. -- Connect the UserInputService input began event
  145. UserInputService.InputBegan:Connect(function(input)
  146. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  147. onMouseClick()
  148. end
  149. end)
  150.  
  151. -- Function to handle the positioning
  152. local function onRenderStep(deltaTime)
  153. if orbiting then
  154. if targetPlayer and targetPlayer.Character and targetPlayer.Character:FindFirstChild("HumanoidRootPart") then
  155. local targetPos = targetPlayer.Character.HumanoidRootPart.Position
  156. local targetLookVector = targetPlayer.Character.HumanoidRootPart.CFrame.LookVector
  157. local newPos = targetPos + targetLookVector * distanceInFront
  158. Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(newPos, targetPos)
  159. end
  160. end
  161. end
  162.  
  163. -- Connect the RenderStepped event to handle the positioning
  164. RunService.RenderStepped:Connect(onRenderStep)
  165.  
  166. -- Create the "Auto Score" button
  167. local autoScoreButton = Instance.new("TextButton")
  168. autoScoreButton.Size = UDim2.new(0, 150, 0, 50)
  169. autoScoreButton.Position = UDim2.new(0.45, 0, 0.3, -25)
  170. autoScoreButton.Text = "Auto Score: OFF"
  171. autoScoreButton.TextColor3 = Color3.new(1, 1, 1)
  172. autoScoreButton.Font = Enum.Font.SourceSansBold
  173. autoScoreButton.TextSize = 18
  174. autoScoreButton.BackgroundTransparency = 0.5
  175. autoScoreButton.BackgroundColor3 = Color3.new(0, 0, 0)
  176. autoScoreButton.Parent = mainFrame
  177.  
  178. -- List of CFrame positions
  179. local positions = {
  180. CFrame.new(82.0245209, 4.73824358, 147.255615, -0.865853965, 9.99409799e-09, -0.500296831, -2.02986516e-09, 1, 2.34893847e-08, 0.500296831, 2.13539124e-08, -0.865853965),
  181. CFrame.new(81.4850464, 4.7463212, -2.16714334, -0.946834981, -3.82307235e-08, -0.321719587, -3.61803565e-08, 1, -1.23520492e-08, 0.321719587, -5.54236101e-11, -0.946834981),
  182. CFrame.new(-84.419487, 4.73700142, 11.0002966, 0.948681593, 1.83182323e-08, 0.31623292, -4.40376491e-09, 1, -4.47153354e-08, -0.31623292, 4.14764918e-08, 0.948681593),
  183. CFrame.new(-114.350708, 4.73628473, -1.54850757, 0.972152889, -1.08958578e-09, 0.234302208, -1.26084354e-08, 1, 6.0976455e-08, -0.234302208, -6.23402297e-08, 0.972152889)
  184. }
  185.  
  186. -- Function to move the player smoothly
  187. local function moveToPositionSmoothly(position)
  188. local character = Players.LocalPlayer.Character
  189. local hrp = character:FindFirstChild("HumanoidRootPart")
  190.  
  191. if hrp then
  192. local distance = (hrp.Position - position.Position).Magnitude
  193. local timeToMove = distance / speed
  194. local tweenInfo = TweenInfo.new(timeToMove, Enum.EasingStyle.Linear)
  195. local tween = TweenService:Create(hrp, tweenInfo, {CFrame = position})
  196. tween:Play()
  197. tween.Completed:Wait()
  198. end
  199. end
  200.  
  201. -- Function to find the nearest CFrame position
  202. local function findNearestPosition()
  203. local closestPosition = nil
  204. local closestDistance = math.huge
  205. local playerPos = Players.LocalPlayer.Character.HumanoidRootPart.Position
  206.  
  207. for _, position in ipairs(positions) do
  208. local distance = (playerPos - position.Position).Magnitude
  209. if distance < closestDistance then
  210. closestDistance = distance
  211. closestPosition = position
  212. end
  213. end
  214.  
  215. return closestPosition
  216. end
  217.  
  218. -- Function to teleport the player to the nearest position
  219. local function teleportToNearestPosition()
  220. local nearestPosition = findNearestPosition()
  221. if nearestPosition then
  222. moveToPositionSmoothly(nearestPosition)
  223. wait(0.2)
  224. VirtualInputManager:SendKeyEvent(true, Enum.KeyCode.E, false, game)
  225. wait(0.5)
  226. VirtualInputManager:SendKeyEvent(false, Enum.KeyCode.E, false, game)
  227. end
  228. end
  229.  
  230. -- Toggle auto score functionality
  231. local autoScoreActive = false
  232. local function toggleAutoScore()
  233. autoScoreActive = not autoScoreActive
  234. if autoScoreActive then
  235. autoScoreButton.Text = "Auto Score: ON"
  236. autoScoreButton.BackgroundColor3 = Color3.new(0, 1, 0)
  237. while autoScoreActive do
  238. teleportToNearestPosition()
  239. wait(8)
  240. end
  241. else
  242. autoScoreButton.Text = "Auto Score: OFF"
  243. autoScoreButton.BackgroundColor3 = Color3.new(0, 0, 0)
  244. end
  245. end
  246.  
  247. autoScoreButton.MouseButton1Click:Connect(toggleAutoScore)
  248.  
  249. -- Ensure the button is more to the right
  250. autoScoreButton.Position = UDim2.new(0.55, 0, 0.3, -25)
  251.  
  252. -- Function to check the entered key
  253. local function checkKey()
  254. if keyTextBox.Text == correctKey then
  255. enterKeyFrame.Visible = false
  256. mainFrame.Visible = true
  257. else
  258. enterButton.Text = "Wrong Key!"
  259. wait(4)
  260. enterButton.Text = "Enter"
  261. end
  262. end
  263.  
  264. -- Connect the enter button click event
  265. enterButton.MouseButton1Click:Connect(checkKey)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement