Advertisement
scriptingtales

Gui Aim Roblox

Jun 3rd, 2023 (edited)
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.43 KB | None | 0 0
  1. -- Gui to Lua
  2. -- Version: 3.2
  3.  
  4. -- Instances:
  5.  
  6. local ScreenGui = Instance.new("ScreenGui", owner.PlayerGui)
  7. local Frame = Instance.new("Frame")
  8. local UICorner = Instance.new("UICorner")
  9. local AimToggle = Instance.new("TextButton")
  10. local UICorner_2 = Instance.new("UICorner")
  11. local Froim = Instance.new("TextLabel")
  12. local UICorner_3 = Instance.new("UICorner")
  13.  
  14. --Properties:
  15.  
  16. Frame.Parent = ScreenGui
  17. Frame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  18. Frame.Position = UDim2.new(0.0648147687, 0, 0.296748012, 0)
  19. Frame.Size = UDim2.new(0, 187, 0, 236)
  20.  
  21. UICorner.Parent = Frame
  22.  
  23. AimToggle.Name = "AimToggle"
  24. AimToggle.Parent = Frame
  25. AimToggle.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  26. AimToggle.Position = UDim2.new(0.101604283, 0, 0.516949177, 0)
  27. AimToggle.Size = UDim2.new(0, 149, 0, 42)
  28. AimToggle.Font = Enum.Font.SourceSansLight
  29. AimToggle.Text = "Off"
  30. AimToggle.TextColor3 = Color3.fromRGB(255, 6, 0)
  31. AimToggle.TextScaled = true
  32. AimToggle.TextSize = 14.000
  33. AimToggle.TextWrapped = true
  34.  
  35. UICorner_2.Parent = AimToggle
  36.  
  37. Froim.Name = "Froim"
  38. Froim.Parent = Frame
  39. Froim.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  40. Froim.Position = UDim2.new(0.00534759369, 0, 0, 0)
  41. Froim.Size = UDim2.new(0, 186, 0, 50)
  42. Froim.Font = Enum.Font.SourceSansLight
  43. Froim.Text = "Aimbot"
  44. Froim.TextColor3 = Color3.fromRGB(0, 0, 0)
  45. Froim.TextScaled = true
  46. Froim.TextSize = 14.000
  47. Froim.TextWrapped = true
  48.  
  49. UICorner_3.Parent = Froim
  50.  
  51. -- Scripts:
  52.  
  53. local function BAIOOPO_fake_script() -- AimToggle.ToggleScript
  54.     local script = Instance.new('LocalScript', AimToggle)
  55.  
  56.     script.Parent.MouseButton1Click:Connect(function()
  57.         if script.Parent.TextColor3 == Color3.fromRGB(255, 0, 0) then
  58.             script.Parent.Text = "On"
  59.             script.Parent.TextColor3 = Color3.fromRGB(0, 255, 0)
  60.         else
  61.             script.Parent.Text = "Off"
  62.             script.Parent.TextColor3 = Color3.fromRGB(255, 0, 0)
  63.         end
  64.        
  65.        
  66.        
  67.         -- set the color you're looking for
  68.         local targetColor = Color3.fromRGB(255, 0, 0) -- color red
  69.    
  70.         -- get all parts with the target color
  71.         local targets = game:GetService("CollectionService"):GetTagged("TargetColor")
  72.    
  73.         -- function to calculate the distance between two Vector3 positions
  74.         local function distance(pos1, pos2)
  75.             return (pos1 - pos2).magnitude
  76.         end
  77.    
  78.         -- loop through all the targets and find the nearest one
  79.         local target = nil
  80.         local distanceToTarget = math.huge
  81.         for _, part in ipairs(targets) do
  82.             if part.Color == targetColor then -- check if it's the target color
  83.                 local dist = distance(part.Position, script.Parent.Position)
  84.                 if dist < distanceToTarget then -- check if it's the closest one so far
  85.                     target = part
  86.                     distanceToTarget = dist
  87.                 end
  88.             end
  89.         end
  90.    
  91.         -- aim at the target
  92.         if target then
  93.             local desiredAimDirection = (target.Position - script.Parent.Position).unit
  94.             script.Parent.CFrame = CFrame.lookAt(script.Parent.Position + desiredAimDirection*5, target.Position)
  95.    
  96.             -- create a projectile and shoot it at the target
  97.             local projectile = Instance.new("Part")
  98.             projectile.Shape = Enum.PartType.Ball
  99.             projectile.Size = Vector3.new(1, 1, 1)
  100.             projectile.Color = Color3.new(1, 1, 0) -- yellow
  101.             projectile.Position = script.Parent.Position + script.Parent.CFrame.lookVector*2
  102.             projectile.CanCollide = false
  103.             projectile.Velocity = script.Parent.CFrame.lookVector * 50
  104.             projectile.Parent = game.Workspace
  105.         end
  106.    
  107.     end)
  108. end
  109. coroutine.wrap(BAIOOPO_fake_script)()
  110.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement