Advertisement
rObl0xexpl0it3r

Untitled

Nov 29th, 2024 (edited)
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.92 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local UserInputService = game:GetService("UserInputService")
  3. local Teams = game:GetService("Teams")
  4.  
  5. -- Your username
  6. local myUsername = "ilovedeltax666"
  7.  
  8. -- The team that can use the box feature (change this to the name of your team)
  9. local allowedTeamName = "Admins" -- Example: "Admins", set your team name here
  10.  
  11. -- GUI Setup
  12. local player = Players.LocalPlayer
  13. local playerGui = player:WaitForChild("PlayerGui")
  14.  
  15. -- Create GUI and button
  16. local screenGui = Instance.new("ScreenGui", playerGui)
  17. local button = Instance.new("TextButton", screenGui)
  18. button.Size = UDim2.new(0, 200, 0, 50)
  19. button.Position = UDim2.new(0.5, -100, 0, 50)
  20. button.Text = "Turn On Boxes"
  21. button.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
  22. button.Font = Enum.Font.SourceSans
  23. button.TextSize = 24
  24.  
  25. -- Variables
  26. local boxesEnabled = false
  27. local aimAssistEnabled = false
  28.  
  29. -- Check if the player is in the allowed team
  30. local function isPlayerAllowed()
  31. return player.Team and player.Team.Name == allowedTeamName
  32. end
  33.  
  34. -- Toggle Boxes
  35. local function toggleBoxes()
  36. if not isPlayerAllowed() then
  37. print("You are not in the allowed team to use this feature.")
  38. return
  39. end
  40.  
  41. boxesEnabled = not boxesEnabled
  42. button.Text = boxesEnabled and "Turn Off Boxes" or "Turn On Boxes"
  43.  
  44. -- Create/Remove boxes for all players
  45. for _, p in pairs(Players:GetPlayers()) do
  46. if p.Name ~= myUsername and p.Character then
  47. local humanoidRoot = p.Character:FindFirstChild("HumanoidRootPart")
  48. if humanoidRoot then
  49. if boxesEnabled then
  50. local billboard = Instance.new("BillboardGui", humanoidRoot)
  51. billboard.Size = UDim2.new(2, 0, 3, 0)
  52. billboard.AlwaysOnTop = true
  53. local frame = Instance.new("Frame", billboard)
  54. frame.Size = UDim2.new(1, 0, 1, 0)
  55. frame.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
  56. frame.BackgroundTransparency = 0.5
  57. frame.BorderSizePixel = 2
  58. frame.BorderColor3 = Color3.fromRGB(0, 0, 0)
  59. else
  60. for _, gui in pairs(humanoidRoot:GetChildren()) do
  61. if gui:IsA("BillboardGui") then gui:Destroy() end
  62. end
  63. end
  64. end
  65. end
  66. end
  67. end
  68.  
  69. -- AimAssist
  70. local function aimAssist()
  71. if boxesEnabled then
  72. local closestPlayer
  73. local shortestDistance = math.huge
  74. local camera = workspace.CurrentCamera
  75. for _, target in pairs(Players:GetPlayers()) do
  76. if target.Character and target.Name ~= myUsername then
  77. local humanoidRoot = target.Character:FindFirstChild("HumanoidRootPart")
  78. if humanoidRoot then
  79. local direction = (humanoidRoot.Position - camera.CFrame.Position).unit
  80. local dot = direction:Dot(camera.CFrame.LookVector)
  81. if dot > 0.8 then
  82. local distance = (humanoidRoot.Position - camera.CFrame.Position).Magnitude
  83. if distance < shortestDistance then
  84. shortestDistance = distance
  85. closestPlayer = target
  86. end
  87. end
  88. end
  89. end
  90. end
  91. if closestPlayer then
  92. camera.CFrame = CFrame.new(camera.CFrame.Position, closestPlayer.Character.HumanoidRootPart.Position)
  93. end
  94. end
  95. end
  96.  
  97. -- Button click event
  98. button.MouseButton1Click:Connect(toggleBoxes)
  99.  
  100. -- AimAssist when boxes are enabled
  101. game:GetService("RunService").Heartbeat:Connect(function()
  102. if boxesEnabled then
  103. aimAssist()
  104. end
  105. end)
  106.  
  107. -- Respawn AimAssist reset
  108. player.CharacterAdded:Connect(function()
  109. aimAssistEnabled = false
  110. end)
  111.  
  112.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement