Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local UserInputService = game:GetService("UserInputService")
- local Teams = game:GetService("Teams")
- -- Your username
- local myUsername = "ilovedeltax666"
- -- The team that can use the box feature (change this to the name of your team)
- local allowedTeamName = "Admins" -- Example: "Admins", set your team name here
- -- GUI Setup
- local player = Players.LocalPlayer
- local playerGui = player:WaitForChild("PlayerGui")
- -- Create GUI and button
- local screenGui = Instance.new("ScreenGui", playerGui)
- local button = Instance.new("TextButton", screenGui)
- button.Size = UDim2.new(0, 200, 0, 50)
- button.Position = UDim2.new(0.5, -100, 0, 50)
- button.Text = "Turn On Boxes"
- button.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
- button.Font = Enum.Font.SourceSans
- button.TextSize = 24
- -- Variables
- local boxesEnabled = false
- local aimAssistEnabled = false
- -- Check if the player is in the allowed team
- local function isPlayerAllowed()
- return player.Team and player.Team.Name == allowedTeamName
- end
- -- Toggle Boxes
- local function toggleBoxes()
- if not isPlayerAllowed() then
- print("You are not in the allowed team to use this feature.")
- return
- end
- boxesEnabled = not boxesEnabled
- button.Text = boxesEnabled and "Turn Off Boxes" or "Turn On Boxes"
- -- Create/Remove boxes for all players
- for _, p in pairs(Players:GetPlayers()) do
- if p.Name ~= myUsername and p.Character then
- local humanoidRoot = p.Character:FindFirstChild("HumanoidRootPart")
- if humanoidRoot then
- if boxesEnabled then
- local billboard = Instance.new("BillboardGui", humanoidRoot)
- billboard.Size = UDim2.new(2, 0, 3, 0)
- billboard.AlwaysOnTop = true
- local frame = Instance.new("Frame", billboard)
- frame.Size = UDim2.new(1, 0, 1, 0)
- frame.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
- frame.BackgroundTransparency = 0.5
- frame.BorderSizePixel = 2
- frame.BorderColor3 = Color3.fromRGB(0, 0, 0)
- else
- for _, gui in pairs(humanoidRoot:GetChildren()) do
- if gui:IsA("BillboardGui") then gui:Destroy() end
- end
- end
- end
- end
- end
- end
- -- AimAssist
- local function aimAssist()
- if boxesEnabled then
- local closestPlayer
- local shortestDistance = math.huge
- local camera = workspace.CurrentCamera
- for _, target in pairs(Players:GetPlayers()) do
- if target.Character and target.Name ~= myUsername then
- local humanoidRoot = target.Character:FindFirstChild("HumanoidRootPart")
- if humanoidRoot then
- local direction = (humanoidRoot.Position - camera.CFrame.Position).unit
- local dot = direction:Dot(camera.CFrame.LookVector)
- if dot > 0.8 then
- local distance = (humanoidRoot.Position - camera.CFrame.Position).Magnitude
- if distance < shortestDistance then
- shortestDistance = distance
- closestPlayer = target
- end
- end
- end
- end
- end
- if closestPlayer then
- camera.CFrame = CFrame.new(camera.CFrame.Position, closestPlayer.Character.HumanoidRootPart.Position)
- end
- end
- end
- -- Button click event
- button.MouseButton1Click:Connect(toggleBoxes)
- -- AimAssist when boxes are enabled
- game:GetService("RunService").Heartbeat:Connect(function()
- if boxesEnabled then
- aimAssist()
- end
- end)
- -- Respawn AimAssist reset
- player.CharacterAdded:Connect(function()
- aimAssistEnabled = false
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement