mattofm

Aimbot GUI script for strucid

Sep 6th, 2020
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.63 KB | None | 0 0
  1.  
  2. local UI = game:GetObjects("rbxassetid://2989692423")[1]
  3. local Services = setmetatable(game:GetChildren(), {
  4. __index = function(self, Service)
  5. return game:GetService(Service)
  6. end
  7. })
  8. local Me = Services.Players.LocalPlayer
  9. local Camera = workspace.CurrentCamera
  10. local Code = Services.HttpService:GenerateGUID(true)
  11. local DeltaSens
  12. local Settings = setmetatable({
  13. Set = function(self, Setting, Value)
  14. local Label = UI[Setting]
  15. if Setting:sub(#Setting - 2) == "Key" then
  16. Label.State.Text = Value.Name
  17. else
  18. Label.State.Text = Value and "ON" or "OFF"
  19. Label.State.TextColor3 = Value and Color3.new(0,1,0) or Color3.new(1,0,0)
  20. end
  21. end,
  22. Hook = function(self, Setting, Function)
  23. return UI[Setting].State:GetPropertyChangedSignal("Text"):Connect(function()
  24. Function(UI[Setting].State.Text == "ON")
  25. end)
  26. end
  27. }, {
  28. __index = function(self, Setting)
  29. if Setting:sub(#Setting - 2) == "Key" then
  30. local Setting = UI[Setting].State.Text
  31. return Setting ~= "Awaiting input..." and ((Setting:match("MouseButton") and Enum.UserInputType[Setting]) or Enum.KeyCode[Setting])
  32. elseif UI[Setting]:FindFirstChild("Slide") then
  33. return tonumber(UI[Setting].Value.Text)
  34. else
  35. return UI[Setting].State.Text == "ON"
  36. end
  37. end
  38. })
  39. local Utility = {
  40. GetPlayer = function(self)
  41. local MousePos = Services.UserInputService:GetMouseLocation()
  42. local Players = Services.Players:GetPlayers()
  43. local Selected, Distance = nil, Settings.MaxDistance
  44. for i = 1, #Players do
  45. local Player = Players[i]
  46. local Character = Player.Character or workspace:FindFirstChild(Player.Name, true)
  47. local Head = Character and (Character:FindFirstChild(Settings.AimForHead and "Head" or "HumanoidRootPart", true) or Character.PrimaryPart)
  48. if (Player ~= Me) and (self:IsValidHead(Head)) and ((Settings.TeamCheck and Player.TeamColor ~= Me.TeamColor) or (not Settings.TeamCheck)) then
  49. local Point, Visible = Camera:WorldToScreenPoint(Head.Position)
  50. if Visible then
  51. local SelectedDistance = (Vector2.new(Point.X, Point.Y) - MousePos).Magnitude
  52. local Eval = SelectedDistance <= Distance
  53. Selected = Eval and Head or Selected
  54. Distance = Eval and SelectedDistance or Distance
  55. end
  56. end
  57. end
  58. return Selected
  59. end,
  60. GetInputType = function(self, Input)
  61. return Input.KeyCode.Name ~= "Unknown" and Input.KeyCode or
  62. Input.UserInputType.Name:match("MouseButton") and Input.UserInputType
  63. end,
  64. IsValidHead = function(self, Head)
  65. if not Head then
  66. return false
  67. end
  68. local Character = Head:FindFirstAncestorOfClass("Model")
  69. local Humanoid = Character and (Character:FindFirstChildWhichIsA("Humanoid",true) or {Health = (Character:FindFirstChild("Health",true) or {Value = 1}).Value})
  70. local _, Visible = Camera:WorldToViewportPoint(Head.Position)
  71. return Humanoid and Visible and Humanoid.Health > 0
  72. end
  73. }
  74. local ContextActionFunctions = {
  75. Aimbotting = function(_, State)
  76. if not Settings.Functionality or (Settings.AimKeyToggles and State == Enum.UserInputState.End) then
  77. return
  78. end
  79. Settings:Set("Aimbotting", not Settings.Aimbotting)
  80. end,
  81. Functionality = function(_, State)
  82. if State == Enum.UserInputState.Begin and not Settings.Aimbotting then
  83. Settings:Set("Functionality", not Settings.Functionality)
  84. end
  85. end
  86. }
  87. local MoveMouse = (Input and Input.MoveMouse) or mousemoverel
  88. for Index, Button in next, UI:GetChildren() do
  89. if Button.ClassName == "TextButton" and Button:FindFirstChild("State") then
  90. if Button.Name:sub(#Button.Name - 2) == "Key" then
  91. local FunctionName = Button.Name:sub(1, #Button.Name - 3)
  92. Button.MouseButton1Click:Connect(function()
  93. Services.ContextActionService:UnbindAction(Code..Button.Name:sub(1, #Button.Name - 3))
  94. Button.State.Text = "Awaiting input..."
  95. local Input
  96. repeat
  97. Input = Utility:GetInputType(Services.UserInputService.InputBegan:Wait())
  98. until Input
  99. Settings:Set(Button.Name, Input)
  100. end)
  101. Settings:Hook(Button.Name, function()
  102. local Input = Settings[Button.Name]
  103. if Input then
  104. Services.ContextActionService:BindAction(Code..FunctionName, ContextActionFunctions[FunctionName], false, Input)
  105. end
  106. end)
  107. Services.ContextActionService:BindAction(Code..FunctionName, ContextActionFunctions[FunctionName], false, Settings[Button.Name])
  108. else
  109. Button.MouseButton1Click:Connect(function()
  110. Settings:Set(Button.Name, not Settings[Button.Name])
  111. end)
  112. end
  113. elseif Button:FindFirstChild("Slide") then
  114. local Slider = Button.Slide.Slider
  115. Slider.MouseButton1Down:Connect(function()
  116. local MaxValue = tonumber(Button.Value.Text) / Slider.Position.X.Scale
  117. while Services.UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) do
  118. local Mouse = Services.UserInputService:GetMouseLocation()
  119. Slider.Position = UDim2.new(
  120. math.clamp((Mouse.X - Slider.Parent.AbsolutePosition.X) / 184, 0, 1),
  121. 0,
  122. .5,
  123. -3
  124. )
  125. Button.Value.Text = math.floor(MaxValue * Slider.Position.X.Scale)
  126. Services.RunService.RenderStepped:Wait()
  127. end
  128. end)
  129. end
  130. end
  131. local CF = CFrame.new
  132. local V2 = Vector2.new
  133. Settings:Hook("Aimbotting", function(Aimbotting)
  134. if Aimbotting then
  135. local Aim = Utility:GetPlayer()
  136. local Smoothness = 1 - Settings.Smoothness / 100
  137. if MoveMouse and Smoothness > 0 then
  138. DeltaSens = Services.UserInputService.MouseDeltaSensitivity
  139. Services.UserInputService.MouseDeltaSensitivity = Smoothness
  140. Services.RunService:BindToRenderStep(Code.."RenderStep", 2000, function()
  141. if not Utility:IsValidHead(Aim) then
  142. Aim = Utility:GetPlayer()
  143. return
  144. end
  145. local ScreenPoint = Camera:WorldToViewportPoint(Aim.Position)
  146. local MousePos = V2(ScreenPoint.X, ScreenPoint.Y) - Services.UserInputService:GetMouseLocation()
  147. MoveMouse(MousePos.X, MousePos.Y)
  148. end)
  149. else
  150. Services.RunService:BindToRenderStep(Code.."RenderStep", 2000, function()
  151. if not Utility:IsValidHead(Aim) then
  152. Aim = Utility:GetPlayer()
  153. return
  154. end
  155. Camera.CFrame = Camera.CFrame:Lerp(CF(Camera.CFrame.Position, Aim.Position), Smoothness)
  156. end)
  157. end
  158. else
  159. Services.UserInputService.MouseDeltaSensitivity = DeltaSens
  160. Services.RunService:UnbindFromRenderStep(Code.."RenderStep")
  161. end
  162. end)
  163. Services.ContextActionService:BindAction(Code.."CloseOpen", function(_, State)
  164. if State == Enum.UserInputState.Begin and Services.UserInputService:IsKeyDown(Enum.KeyCode.LeftControl) then
  165. UI.Visible = not UI.Visible
  166. end
  167. end, false, Enum.KeyCode.Tab)
  168. Settings:Set("TeamCheck", #Services.Teams:GetChildren() > 0)
  169. UI.Name = Code
  170. UI.Parent = game:GetService("CoreGui"):FindFirstChildOfClass("ScreenGui")
  171.  
Add Comment
Please, Sign In to add comment