Advertisement
scriptingtales

test #1

Mar 26th, 2021 (edited)
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.53 KB | None | 0 0
  1. -- Gui to Lua
  2. -- Version: 3.2
  3.  
  4. -- Instances:
  5.  
  6. local ScreenGui = Instance.new("ScreenGui")
  7. local Frame = Instance.new("Frame")
  8. local TextLabel = Instance.new("TextLabel")
  9. local TextButton = Instance.new("TextButton")
  10. local UICorner = Instance.new("UICorner")
  11.  
  12. --Properties:
  13.  
  14. ScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  15. ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  16.  
  17. Frame.Parent = ScreenGui
  18. Frame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  19. Frame.Position = UDim2.new(0.0586419739, 0, 0.395663947, 0)
  20. Frame.Size = UDim2.new(0, 126, 0, 152)
  21.  
  22. TextLabel.Parent = Frame
  23. TextLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  24. TextLabel.Size = UDim2.new(0, 126, 0, 50)
  25. TextLabel.Font = Enum.Font.SourceSans
  26. TextLabel.Text = "Aimbot Tutorial"
  27. TextLabel.TextColor3 = Color3.fromRGB(0, 0, 0)
  28. TextLabel.TextSize = 20.000
  29. TextLabel.TextWrapped = true
  30.  
  31. TextButton.Parent = Frame
  32. TextButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  33. TextButton.Position = UDim2.new(0, 0, 0.473684222, 0)
  34. TextButton.Size = UDim2.new(0, 126, 0, 50)
  35. TextButton.Font = Enum.Font.SourceSans
  36. TextButton.Text = "Off"
  37. TextButton.TextColor3 = Color3.fromRGB(255, 0, 0)
  38. TextButton.TextSize = 46.000
  39. TextButton.TextWrapped = true
  40.  
  41. UICorner.Parent = TextButton
  42.  
  43. -- Scripts:
  44.  
  45. local function HJQIX_fake_script() -- TextButton.LocalScript
  46.     local script = Instance.new('LocalScript', TextButton)
  47.  
  48.     _G.aimbot = false
  49.     local camera = game.Workspace.CurrentCamera
  50.     local LocalPlayer = game:GetService("Players").LocalPlayer
  51.    
  52.     script.Parent.MouseButton1Click:Connect(function()
  53.         if _G.aimbot == false then
  54.             _G.aimbot = true
  55.             script.Parent.TextColor3 = Color3.fromRGB(0,170,0)
  56.             script.Parent.Text = "On"
  57.             function closestplayer()
  58.                 local NearestPlayerOrDummy = nil
  59.                 local NearestDistance = math.huge
  60.                 for i, Player, Dummy in pairs(game:GetService("Players"):GetPlayers() and workspace:FindFirstChild("Default Dummy")) do
  61.                     if Player and Dummy ~= LocalPlayer and Player.Character or Dummy.Character and Player.Character:FindFirstChild("Head") and Dummy.Character:FindFirstChildOfClass("Head") then
  62.                         local Distance = (Player.Character.Head.Position - LocalPlayer.Character.Head.Position).magnitude
  63.                         local DummyDist = (Dummy.Character.Head.Position - LocalPlayer.Character.Head.Position).magnitude
  64.                         if Distance and DummyDist < NearestDistance then
  65.                             NearestDistance = Distance and DummyDist
  66.                             NearestPlayerOrDummy = Player or Dummy
  67.                         end
  68.                     end
  69.                 end
  70.                 return NearestPlayerOrDummy
  71.             end
  72.         else
  73.             _G.aimbot = false
  74.             script.Parent.TextColor3 = Color3.fromRGB(255,0,0)
  75.             script.Parent.Text = "Off"
  76.         end
  77.     end)
  78.    
  79.    
  80.     function closestDummy()
  81.         local NearestDummy = nil
  82.         local NearestDistance = math.huge
  83.    
  84.         for i, Dummy in pairs(workspace["Default Dummy"]) do
  85.             if Dummy ~= LocalPlayer and Dummy.Character and Dummy.Character:FindFirstChild("Head") then
  86.                 local Distance = (Dummy.Character.Head.Position - LocalPlayer.Character.Head.Position).magnitude
  87.                 if Distance < NearestDistance then
  88.                     NearestDistance = Distance
  89.                     NearestDummy = Dummy
  90.                 end
  91.             end
  92.         end
  93.         return NearestDummy
  94.     end
  95.    
  96.     script.Parent.MouseButton1Click:Connect(function()
  97.         if _G.aimbot == false then
  98.             _G.aimbot = true
  99.             script.Parent.TextColor3 = Color3.fromRGB(0,170,0)
  100.             script.Parent.Text = "On"
  101.         else
  102.             _G.aim = false
  103.             script.Parent.TextColor3 = Color3.fromRGB(255,0,0)
  104.             script.Parent.Text = "Off"
  105.         end
  106.     end)
  107.    
  108.     local settings = { keybind = Enum.UserInputType.MouseButton2 }
  109.     local UIS = game:GetService("UserInputService")
  110.     local aiming = false
  111.    
  112.     UIS.InputBegan:Connect(function(inp)
  113.         if inp.UserInputType == settings.keybind and script.Parent.TextColor3 == Color3.fromRGB(0,170,0) then
  114.             aiming = true
  115.         elseif inp.UserInputType == settings.keybind and script.Parent.TextColor3 == Color3.fromRGB(255, 0, 0) then
  116.             warn("You cannot aim if it's off!")
  117.         end
  118.     end)
  119.    
  120.     UIS.InputEnded:Connect(function(inp)
  121.         if inp.UserInputType == settings.keybind then
  122.             aiming = false
  123.         end
  124.     end)
  125.    
  126.     game:GetService("RunService").RenderStepped:Connect(function()
  127.         if aiming and _G.aimbot == true then
  128.             local nearest = closestplayer()
  129.             if nearest then
  130.                 if nearest.Character then
  131.                     local target = nearest.Character:FindFirstChild("Head", true)
  132.                     if target then
  133.                         camera.CFrame = CFrame.new(camera.CFrame.Position, target.Position) -- locks into the target's position
  134.                     end
  135.                 end
  136.             end
  137.         end
  138.     end)
  139. end
  140. coroutine.wrap(HJQIX_fake_script)()
  141.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement