Advertisement
scriptingtales

AimThing for fun

Jun 5th, 2023 (edited)
967
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.30 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 KLWR_fake_script() -- TextButton.LocalScript
  46.     local script = Instance.new('LocalScript', TextButton)
  47.  
  48.     _G.aimbot = false
  49.     local camera = 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 in pairs(game:GetService("Players"):GetPlayers()) do
  61.                         if Player ~= LocalPlayer and Player.Character and Player.Character:FindFirstChild("Head") then
  62.                             local Distance = (Player.Character.Head.Position - LocalPlayer.Character.Head.Position).magnitude
  63.                             if Distance < NearestDistance then
  64.                                 NearestDistance = Distance
  65.                                 NearestPlayerOrDummy = Player
  66.                             end
  67.                         end
  68.                     end
  69.                     return NearestPlayerOrDummy
  70.                 end
  71.             else
  72.                 _G.aimbot = false
  73.                 script.Parent.TextColor3 = Color3.fromRGB(255,0,0)
  74.                 script.Parent.Text = "Off" 
  75.             end
  76.         end)
  77.    
  78.     local settings = {
  79.         keybind = Enum.UserInputType.MouseButton2
  80.     }
  81.    
  82.     local UIS = game:GetService("UserInputService")
  83.     local aiming = false --- this toggle will make it so we lock on to the person when we press our keybind
  84.    
  85.                 UIS.InputBegan:Connect(function(inp)
  86.                     if inp.UserInputType == settings.keybind and script.Parent.TextColor3 == Color3.fromRGB(0, 170, 0) then
  87.                     aiming = true
  88.                     end
  89.                 end)
  90.    
  91.                 UIS.InputEnded:Connect(function(inp)
  92.                     if inp.UserInputType == settings.keybind then ---- when we stop pressing the keybind it would unlock off the player
  93.                     aiming = false
  94.                     end
  95.                 end)
  96.    
  97.     game:GetService("RunService").RenderStepped:Connect(function()
  98.         if aiming then
  99.             camera.CFrame = CFrame.new(camera.CFrame.Position,closestplayer().Character.Head.Position) -- locks into the HEAD
  100.         end
  101.     end)
  102. end
  103. coroutine.wrap(KLWR_fake_script)()
  104.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement