local ball = script.Parent -- Assuming the script is attached to the ball
local debounce = false
local function onKeyPress(input)
if input.KeyCode == Enum.KeyCode.E and not debounce then
debounce = true
-- Find the player who owns the ball
local character = ball.Parent
local player = game.Players:GetPlayerFromCharacter(character)
-- Ensure player and ball are valid and the ball is below the player
if player and ball and character and character:FindFirstChild("HumanoidRootPart") then
if ball.Position.Y < character.HumanoidRootPart.Position.Y then
ball.Position = character.HumanoidRootPart.Position + Vector3.new(0, 5, 0) -- Adjust the Vector3 values as needed
end
end
-- Wait a short period to fully debounce
wait(0.1)
debounce = false
end
end
game:GetService("UserInputService").InputBegan:Connect(onKeyPress)