Problem shooting basketball?

Basically I’m trying to make a basketball shooting system, and I used EgoMoose’s tutorial, but I wanted to change a couple things:

  • I only want the ball to be able to be shot while the ball is in the player’s hands.
  • Instead of cloning the ball, I want the tool to be dropped, while the handle is still shooting.

I’m having problems accomplishing this, here’s my code:

Local Script:

	local t = 1;
	local mouse = game.Players.LocalPlayer:GetMouse();
	local hrp = game.Players.LocalPlayer.CharacterAdded:Wait():WaitForChild("HumanoidRootPart");
	local bball = script.Parent:WaitForChild("Handle");

		local g =, -game.Workspace.Gravity, 0);
		local x0 = hrp.CFrame *, 2, -2)

		-- calculate the v0 needed to reach mouse.Hit.p
		local v0 = (mouse.Hit.p - x0 - 0.5*g*t*t)/t;
		local b = game.Players.LocalPlayer:WaitForChild("Backpack"):FindFirstChild("Basketball")
		game.ReplicatedStorage.Shooting:FireServer(v0, x0, b)

Server Script:

game.ReplicatedStorage.Shooting.OnServerEvent:Connect(function(player, v0, x0, b)
	local h = b:FindFirstChild("Handle")
	h.Velocity = v0;
	h.CFrame =;
	h.CanCollide = true;
	b.Parent = game.Workspace;

I get an error that says: ServerScriptService.Script:2: attempt to index nil with 'FindFirstChild', but I’m not sure how I’m trying to find a child in something that doesn’t exist. How can I accomplish my goal and eliminate the errors?

A solution I tried was adding a wait in the server script, and while it doesn’t throw any errors, nothing is happening.