test for later
Key RequiredUniversal

test for later

Universal ScriptKyeliszKyelisz 605 views 72 executesUpdated Mar 24, 2026
Unrated
00
Lua Script•178 lines (5710 chars)
--// Brookhaven Ball Launcher - Clean Live Tracking (Fixed Height)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local player = Players.LocalPlayer
local mouse = player:GetMouse()

local object = nil
local startPos, endPos
local progress = 0
local duration = 2

-- GUI
local screenGui = Instance.new("ScreenGui")
screenGui.ResetOnSpawn = false
screenGui.Parent = player:WaitForChild("PlayerGui")

local mainFrame = Instance.new("Frame")
mainFrame.Size = UDim2.new(0, 280, 0, 380)
mainFrame.Position = UDim2.new(0.5, -140, 0.5, -190)
mainFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
mainFrame.Parent = screenGui

Instance.new("UIStroke", mainFrame).Color = Color3.fromRGB(0, 255, 100)
Instance.new("UIStroke", mainFrame).Thickness = 3
Instance.new("UICorner", mainFrame).CornerRadius = UDim.new(0, 12)

local title = Instance.new("TextLabel")
title.Size = UDim2.new(1, 0, 0, 50)
title.BackgroundTransparency = 1
title.Text = "⚽ Ball Launcher"
title.TextColor3 = Color3.fromRGB(255, 255, 255)
title.TextScaled = true
title.Font = Enum.Font.GothamBold
title.Parent = mainFrame

local scrollFrame = Instance.new("ScrollingFrame")
scrollFrame.Size = UDim2.new(1, -20, 0, 220)
scrollFrame.Position = UDim2.new(0, 10, 0, 60)
scrollFrame.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
scrollFrame.ScrollBarThickness = 8
scrollFrame.Parent = mainFrame

local listLayout = Instance.new("UIListLayout")
listLayout.Padding = UDim.new(0, 6)
listLayout.SortOrder = Enum.SortOrder.Name
listLayout.Parent = scrollFrame

local selectLabel = Instance.new("TextLabel")
selectLabel.Size = UDim2.new(1, -20, 0, 30)
selectLabel.Position = UDim2.new(0, 10, 0, 290)
selectLabel.BackgroundTransparency = 1
selectLabel.Text = "Selected: None"
selectLabel.TextColor3 = Color3.fromRGB(180, 180, 180)
selectLabel.TextScaled = true
selectLabel.Font = Enum.Font.Gotham
selectLabel.Parent = mainFrame

local launchButton = Instance.new("TextButton")
launchButton.Size = UDim2.new(1, -20, 0, 50)
launchButton.Position = UDim2.new(0, 10, 0, 325)
launchButton.BackgroundColor3 = Color3.fromRGB(0, 170, 80)
launchButton.Text = "🚀 LAUNCH BALL"
launchButton.TextColor3 = Color3.fromRGB(255, 255, 255)
launchButton.TextScaled = true
launchButton.Font = Enum.Font.GothamBold
launchButton.Parent = mainFrame

for _, v in ipairs({title, scrollFrame, launchButton}) do
	Instance.new("UICorner", v).CornerRadius = UDim.new(0, v == title and 12 or 8)
end

local selectedPlayer = nil
local playerButtons = {}

local function createPlayerButton(plr)
	if plr == player or playerButtons[plr] then return end
	local btn = Instance.new("TextButton")
	btn.Size = UDim2.new(1, -10, 0, 40)
	btn.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
	btn.Text = plr.Name
	btn.TextColor3 = Color3.fromRGB(255, 255, 255)
	btn.TextScaled = true
	btn.Font = Enum.Font.Gotham
	btn.Parent = scrollFrame
	Instance.new("UICorner", btn).CornerRadius = UDim.new(0, 8)

	btn.MouseButton1Click:Connect(function()
		selectedPlayer = plr
		selectLabel.Text = "Selected: " .. plr.Name
		for _, b in pairs(playerButtons) do b.BackgroundColor3 = Color3.fromRGB(60, 60, 60) end
		btn.BackgroundColor3 = Color3.fromRGB(0, 170, 80)
	end)
	playerButtons[plr] = btn
end

local function refreshList()
	for _, plr in ipairs(Players:GetPlayers()) do
		if plr ~= player then createPlayerButton(plr) end
	end
	scrollFrame.CanvasSize = UDim2.new(0, 0, 0, listLayout.AbsoluteContentSize.Y + 20)
end

refreshList()
Players.PlayerAdded:Connect(function(plr) if plr ~= player then createPlayerButton(plr) refreshList() end end)
Players.PlayerRemoving:Connect(function(plr)
	if playerButtons[plr] then playerButtons[plr]:Destroy() playerButtons[plr] = nil end
	if selectedPlayer == plr then selectedPlayer = nil selectLabel.Text = "Selected: None" end
	refreshList()
end)

--// LAUNCH - Live tracking with clean height fix
launchButton.MouseButton1Click:Connect(function()
	if not selectedPlayer then
		selectLabel.Text = "Pick a player first!"
		task.wait(1.5)
		selectLabel.Text = "Selected: None"
		return
	end

	object = workspace:FindFirstChild("Soccerg33ign3t", true)
	if not object or not object:IsA("BasePart") then
		warn("Ball not found! Click the soccer ball first.")
		return
	end

	local targetPlr = selectedPlayer
	print("Tracking live position of " .. targetPlr.Name)

	-- Short strong loop that constantly reads current player position
	object.Anchored = true

	for i = 1, 30 do
		if targetPlr.Character and targetPlr.Character:FindFirstChild("HumanoidRootPart") then
			local root = targetPlr.Character.HumanoidRootPart
			-- 6 studs above head (should stop it going underneath)
			local livePos = root.Position + Vector3.new(0, 6, 0)
			object.Position = livePos
			object.Velocity = Vector3.new(0, 8, 0)
		end
		task.wait(0.02)
	end

	object.Anchored = false
	object.Velocity = Vector3.new(0, 3, 0)   -- gentle kick

	launchButton.Text = "✅ TRACKING LIVE!"
	task.wait(0.9)
	launchButton.Text = "🚀 LAUNCH BALL"
end)

-- Click to select ball for rising animation
mouse.Button1Down:Connect(function()
	if mouse.Target and mouse.Target.Name == "Soccerg33ign3t" then
		object = mouse.Target
		startPos = object.Position
		endPos = startPos + Vector3.new(0, 50, 0)
		progress = 0
		print("Ball selected!")
	end
end)

-- Rising animation
RunService.RenderStepped:Connect(function(dt)
	if object and progress < 1 then
		progress += dt / duration
		local accel = progress * progress
		local newPos = startPos:Lerp(endPos, accel)
		object.CFrame = CFrame.new(newPos)

		if progress >= 1 then
			object.CFrame = CFrame.new(startPos)
			progress = 0
		end
	end
end)

print("✅ Clean Live Tracking Fixed - Ball should now stay above the player!")

Features & Information

gggg
#ss

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts