local Players = game:GetService("Players")
local player = [Link]
local UserInputService = game:GetService("UserInputService")
-- Ball detection variables
local BALL_DETECTION_RADIUS = 10000
local ballDetectionActive = true
-- Function to check if a ball is nearby
local function isBallNearby(position)
-- Check for parts named "Ball" or with ball-like properties
for _, part in ipairs(workspace:GetChildren()) do
if part:IsA("Part") or part:IsA("MeshPart") then
-- Check if it's ball-like by name or shape
if ([Link]:lower():find("ball") or [Link] == [Link])
then
local distance = (position - [Link]).Magnitude
if distance <= BALL_DETECTION_RADIUS then
return true
end
end
end
end
return false
end
local function setupCharacter(character)
local humanoid = character:WaitForChild("Humanoid")
local hrp = character:WaitForChild("HumanoidRootPart")
local boostedRecently = false
[Link]:Connect(function(_, newState)
if newState == [Link] and not boostedRecently then
-- Check if a ball is nearby before applying boost
if ballDetectionActive and hrp and isBallNearby([Link]) then
-- Wait a fraction to let the game's native jump begin
[Link](0.05, function()
-- Apply small upward boost (doesn't affect animation or
timing)
if hrp and [Link] and humanoid:GetState() ==
[Link] then
[Link] = [Link] + [Link](0, 12, 0) --
Adjust Y value to increase jump height
end
boostedRecently = true
[Link](0.5, function()
boostedRecently = false
end)
end)
end
end
end)
end
-- Apply to current character
if [Link] then
setupCharacter([Link])
end
-- On respawn
[Link]:Connect(setupCharacter)
-- Jump request handler
[Link]:Connect(function()
if [Link] then
local humanoid = [Link]:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid:ChangeState("Jumping")
end
end
end)