Advertisement
ColdSpecs

Potential park aimbot

Jul 13th, 2023 (edited)
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.45 KB | None | 0 0
  1. -- Generated From Chat GPT-4
  2. -- Variables
  3. local plr = game.Players.LocalPlayer
  4. local uis = game:GetService("UserInputService")
  5. local rs = game:GetService("RunService")
  6.  
  7. local footing = false
  8. local hasBall = false
  9. local ui -- this table will store the UI elements that we need
  10. local mode = Enum.UserInputState.Begin -- this enum value will keep track of whether the script is enabled or not
  11.  
  12. -- Functions
  13.  
  14. function getGoal()
  15. local dist, goal = 9e9
  16. for i,v in pairs(workspace:GetDescendants()) do
  17. if v.Name == "Lol" or v.Name == "Goal" then -- using the original names here
  18. local mag = (plr.Character.Torso.Position - v.Position).Magnitude
  19. if dist > mag then
  20. dist = mag; goal = v;
  21. end
  22. end
  23. end
  24. return goal
  25. end
  26.  
  27. function getVector(goal)
  28. local dist = (plr.Character.Torso.Position - goal.Position).Magnitude
  29. return goal.Position + Vector3.new(0, 45 + (dist / 10)) - plr.Character.Humanoid.MoveDirection
  30. end
  31.  
  32. function shootBall(vector) -- this is a local function that encapsulates the logic of shooting the ball
  33. if hasBall then
  34. local event = plr.Character.Basketball.shoot_event
  35.  
  36. local unit = (vector - plr.Character.Head.Position).Unit
  37. local spawnPos = plr.Character.PrimaryPart.Position + unit * 3.8 -- using a number for spawn offset
  38.  
  39. if spawnPos.Y - plr.Character.PrimaryPart.Position.Y < 4 then
  40. spawnPos = plr.Character.PrimaryPart.Position + unit * 4
  41. end
  42.  
  43. event:FireServer(
  44. vector,
  45. spawnPos,
  46. "\240\159\148\165\240\159\148\165"
  47. )
  48. end
  49. end
  50.  
  51. function handleJumped()
  52. task.wait(0.225) -- putting back the wait here
  53. shootBall(getVector(getGoal())) -- calling the local function here
  54. end
  55.  
  56. function handleRender()
  57. local goal = getGoal()
  58. local dist = (plr.Character.Torso.Position - goal.Position).Magnitude
  59.  
  60. if math.floor(dist) == 57 then -- this condition checks if we are at the desired location
  61. footing = true -- set footing to true
  62. plr.Character.Humanoid.Jump = true -- make the character jump
  63. else
  64. footing = false -- set footing to false
  65. plr.Character.Humanoid:MoveTo(goal.Position - Vector3.new(0, 0, 57)) -- move the character to a point near the goal with a distance of 57 units on the z-axis
  66. end
  67.  
  68. if plr.Character and plr.Character:FindFirstChild("Basketball") then
  69. hasBall = true
  70. else
  71. hasBall = false
  72. end
  73.  
  74. if hasBall then
  75. if footing then
  76. ui.label.TextColor3 = Color3.fromRGB(0, 255, 0) -- using color values here
  77. else
  78. ui.label.TextColor3 = Color3.fromRGB(255, 0, 0)
  79. end
  80. else
  81. ui.label.TextColor3 = Color3.fromRGB(157, 157, 157)
  82. end
  83.  
  84. end
  85.  
  86. -- Connections
  87.  
  88. -- this function toggles the script on or off when F is pressed
  89. function handleKeybind(input)
  90. if input.KeyCode == Enum.KeyCode.F then -- check if the key pressed is F
  91. if mode == Enum.UserInputState.Begin then -- check if the script is enabled
  92. mode = Enum.UserInputState.End -- set the mode to disabled
  93. else -- otherwise, if the script is disabled
  94. mode = Enum.UserInputState.Begin -- set the mode to enabled
  95. end
  96. print("Script enabled:", mode == Enum.UserInputState.Begin) -- print the status of the script
  97. end
  98. end
  99.  
  100. uis.InputBegan:Connect(handleKeybind) -- connect the function to the input event
  101.  
  102. -- these connections only run when the script is enabled
  103.  
  104. rs.Stepped:Connect(function()
  105. if mode == Enum.UserInputState.Begin then -- check if the script is enabled
  106. handleRender() -- run the render function
  107. end
  108. end)
  109.  
  110. plr.Character.Humanoid.Jumping:Connect(function()
  111. if mode == Enum.UserInputState.Begin then -- check if the script is enabled
  112. handleJumped() -- run the jumped function
  113. end
  114. end)
  115.  
  116. -- Initialization
  117.  
  118. -- this function finds and stores the UI elements that we need in a table
  119. function initUI()
  120. ui = {} -- create an empty table for UI elements
  121.  
  122. for i,v in pairs(plr.PlayerGui:GetDescendants()) do -- loop through all descendants of PlayerGui
  123. if v:IsA("TextLabel") and v.Text == "75" then -- find the text label with text "75"
  124. ui.label = v -- store it in the table with the key "label"
  125. break -- exit the loop since we found what we need
  126. end
  127. end
  128.  
  129. assert(ui.label, "Label not found") -- check if we found the label, otherwise throw an error
  130. end
  131.  
  132. initUI() -- call the function to initialize the UI elements
  133.  
  134.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement