Basketball 0.1
Key RequiredUniversal

Basketball 0.1

Universal ScriptIrdkIrdk 60.4K views 441 executesUpdated Jun 2, 2025
5.0/ 5(2 votes)
20100% Positive
Lua Script•206 lines (6551 chars)
-- Services
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local VirtualInputManager = game:GetService("VirtualInputManager")

-- Player info
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local hrp = character:WaitForChild("HumanoidRootPart")

-- Guard vars
local hoopPosition = nil
local target = nil
local guardEnabled = false
local currentDistance = 5
local nextDistance = 5
local lastUpdate = 0

-- E-hold config
local holdDuration = 455
local canHold = true

-- Startup GUI
do
	local startupGui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))
	startupGui.Name = "StartupGui"

	local label = Instance.new("TextLabel", startupGui)
	label.Size = UDim2.new(0, 400, 0, 100)
	label.Position = UDim2.new(0.5, -200, 0.5, -50)
	label.Text = "Made By: Irdk (scriptblox.com)\nDiscord: irdk_scriptblox"
	label.BackgroundColor3 = Color3.new(0.1, 0.1, 0.1)
	label.TextColor3 = Color3.new(1, 1, 1)
	label.TextScaled = true
	label.Font = Enum.Font.SourceSansBold

	task.delay(3, function()
		startupGui:Destroy()
	end)
end

-- GUI setup
local screenGui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))
screenGui.Name = "ControlPanel"

-- Frame
local frame = Instance.new("Frame", screenGui)
frame.Position = UDim2.new(0, 50, 0, 50)
frame.Size = UDim2.new(0, 300, 0, 150)
frame.BackgroundColor3 = Color3.new(0.1, 0.1, 0.1)
frame.BorderSizePixel = 0
frame.Active = true
frame.Draggable = true

-- Label
local label = Instance.new("TextLabel", frame)
label.Size = UDim2.new(0.6, 0, 0.2, 0)
label.Text = "Hold E (ms):"
label.BackgroundTransparency = 1
label.TextColor3 = Color3.new(1, 1, 1)
label.Font = Enum.Font.SourceSans
label.TextSize = 18

-- TextBox
local textBox = Instance.new("TextBox", frame)
textBox.Size = UDim2.new(0.4, 0, 0.2, 0)
textBox.Position = UDim2.new(0.6, 0, 0, 0)
textBox.Text = tostring(holdDuration)
textBox.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
textBox.TextColor3 = Color3.new(1, 1, 1)
textBox.Font = Enum.Font.SourceSans
textBox.TextSize = 18
textBox.ClearTextOnFocus = false

textBox.FocusLost:Connect(function()
	local val = tonumber(textBox.Text)
	if val then holdDuration = val end
end)

-- Toggle helper
local function createToggle(name, posY, note)
	local toggle = Instance.new("TextButton", frame)
	toggle.Size = UDim2.new(0.5, 0, 0.2, 0)
	toggle.Position = UDim2.new(0, 0, posY, 0)
	toggle.BackgroundColor3 = Color3.fromRGB(80, 80, 80)
	toggle.TextColor3 = Color3.new(1, 1, 1)
	toggle.Font = Enum.Font.SourceSans
	toggle.TextSize = 16
	toggle.Text = name .. ": ✗"

	local noteLabel
	if note then
		noteLabel = Instance.new("TextLabel", frame)
		noteLabel.Position = UDim2.new(0.5, 5, posY, 0)
		noteLabel.Size = UDim2.new(0.5, -5, 0.2, 0)
		noteLabel.Text = note
		noteLabel.BackgroundTransparency = 1
		noteLabel.TextColor3 = Color3.fromRGB(200, 200, 200)
		noteLabel.Font = Enum.Font.SourceSansItalic
		noteLabel.TextSize = 14
		noteLabel.TextXAlignment = Enum.TextXAlignment.Left
	end

	local state = false
	toggle.MouseButton1Click:Connect(function()
		state = not state
		toggle.Text = name .. ": " .. (state and "✓" or "✗")
		toggle.BackgroundColor3 = state and Color3.fromRGB(0, 170, 0) or Color3.fromRGB(80, 80, 80)
	end)

	return function()
		return state
	end
end

local getDistanceIndicatorOn = createToggle("Distance Toggle", 0.25)
local getGreenToggleOn = createToggle("Use Green Dot", 0.5)
local getAutoGuardOn = createToggle("Auto Guard", 0.75, "Press B to toggle")

-- Guard UI guide
local guideFrame = Instance.new("Frame", screenGui)
guideFrame.Position = UDim2.new(0.5, -100, 0.7, 0)
guideFrame.Size = UDim2.new(0, 200, 0, 100)
guideFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
guideFrame.Visible = false

local guideText = Instance.new("TextLabel", guideFrame)
guideText.Size = UDim2.new(1, 0, 1, 0)
guideText.TextColor3 = Color3.new(1, 1, 1)
guideText.TextWrapped = true
guideText.TextSize = 16
guideText.Text = "Press L to set hoop\nPress B to toggle auto guard"
guideText.BackgroundTransparency = 1

-- Distance dot
local distDot = Instance.new("Frame", frame)
distDot.Size = UDim2.new(0, 20, 0, 20)
distDot.Position = UDim2.new(1, -25, 0, 5)
distDot.BackgroundColor3 = Color3.new(0, 1, 0)
distDot.Visible = false

-- Input logic
UIS.InputBegan:Connect(function(input, gameProcessed)
	if gameProcessed then return end

	if input.KeyCode == Enum.KeyCode.L then
		hoopPosition = hrp.Position
	elseif input.KeyCode == Enum.KeyCode.B then
		if not hoopPosition then warn("Set the hoop first with L.") return end
		guardEnabled = not guardEnabled
		if guardEnabled then
			local closest, minDist = nil, math.huge
			for _, p in pairs(Players:GetPlayers()) do
				if p ~= player and p.Character and p.Character:FindFirstChild("HumanoidRootPart") then
					local dist = (p.Character.HumanoidRootPart.Position - hrp.Position).Magnitude
					if dist < minDist then
						minDist = dist
						closest = p.Character.HumanoidRootPart
					end
				end
			end
			target = closest
		end
		guideFrame.Visible = guardEnabled and getAutoGuardOn()
	elseif input.KeyCode == Enum.KeyCode.E and canHold then
		canHold = false
		VirtualInputManager:SendKeyEvent(true, Enum.KeyCode.E, false, game)
		task.delay(holdDuration / 1000, function()
			VirtualInputManager:SendKeyEvent(false, Enum.KeyCode.E, false, game)
			canHold = true
		end)
	end
end)

-- Main loop
RunService.RenderStepped:Connect(function(dt)
	if guardEnabled and target and target.Parent and hoopPosition then
		local now = tick()
		if now - lastUpdate > 3 then
			nextDistance = math.random(50, 75) / 10
			lastUpdate = now
		end
		currentDistance = currentDistance + ((nextDistance - currentDistance) * dt * 0.5)

		local dirToPlayer = (target.Position - hoopPosition).Unit
		local guardPos = target.Position - dirToPlayer * currentDistance
		guardPos = Vector3.new(guardPos.X, hrp.Position.Y, guardPos.Z)

		if math.random(1, 180) == 1 then
			local offset = Vector3.new(math.random(-1,1), 0, math.random(-1,1)).Unit * 1.2
			guardPos += offset
		end
		humanoid:MoveTo(guardPos)
	end

	-- Distance dot logic
	if getDistanceIndicatorOn() and target then
		local dist = (target.Position - hrp.Position).Magnitude
		distDot.BackgroundColor3 = dist < 10 and Color3.new(1, 0, 0) or (getGreenToggleOn() and Color3.new(0, 1, 0) or Color3.new(0.2, 0.2, 0.2))
		distDot.Visible = true
	else
		distDot.Visible = false
	end
end)

Features & Information

Universal Basketball Script. version: 0.1 [ FEATURES ] Auto Guard Auto Green Indicator Distance [How to use] Auto Guard: 1. Toggle on 2. Go under the hoop, then press L 3. Press B to use Auto Guard 4. You still need to hold guard, e.g "G", if the game requires so. 5. You still need to hold shift to run, if the game requires so. Auto Green: 1. Toggle on 2. Update the millisecond counter for your personal perfect green 3. Press E to use Auto Green Indicator Distance: 1. Toggle On 2. enemy < 10 (studs): red; enemy > 10: green Future Updates: Auto dribble. (uses z,x,c ; shiftlock .... etc) Auto shoot. (shoots when the Indicator distance is green) Auto dunk. (presses spacebar when near hoop position) Defense Boost. (get a walkspeed boost for defense. [risky] ) HipHeight. (become uncontestable) Auto Block. etc. These "Updates" are very simple to implement yourself. So Go Ahead! Script made by irdk, Discord: idrk_scriptblox
#Basketball#Auto Green#Auto Guard#Basketball Zero#Universal

Community Comments (3)

fahadashfaq25524fahadashfaq25524Jun 2, 2025

Which game this script is

IrdkIrdkJun 3, 2025

@fahadashfaq25524 Its universal, and currently I am adding more features. it should work on alot of basketball games, but I'm aware it wont work with all.

Replying to @Irdk
Wokkhart_Wokkhart_Aug 18, 2025

@Irdk can u do arcade basketball

More Scripts for Universal Scripts