Anyone know why my shooting script that parents the ball in workspace on a remote event is saying

Anyone know why my shooting script that parents the ball in workspace on a remote event is saying

Screenshot 2023-09-04 222420

“Workspace.Basketball.ShootScript:4: attempt to index nil with ‘Position’”

|| My code ||

script.Parent.Shoot.OnServerEvent:Connect(function(Player, Goal, Percentage)
	if script.Parent.Handler.Value == Player.Name then
		local Gravity = Vector3.new(0, -workspace.Gravity, 0)
		local Traject = tonumber(.99) + (Player.Character.HumanoidRootPart.Position - Goal.Position).Magnitude / tonumber(100)
		local X0 = script.Parent.Position
		local V0 = (Goal.Position - X0 - 0.5 * Gravity * Traject * Traject) / Traject
		script.Parent.Contest.Value = 0
		script.Parent.Parent = workspace
		script.Parent.Motor6D.Part0 = nil
		script.Parent.CanCollide = true
		script.Parent.Velocity = V0 + Vector3.new(Percentage - 1, Percentage - 1)
		script.Parent:SetNetworkOwner(nil)
		script.Parent.RotVelocity = Vector3.new(0, 0, 15)
	end
end)


Have you tried printing Goal and making sure it is correct in the arguments to get its .Position?

HumanoidRootPart or Goal is nil. This error appears when you trying to nil[Property], in your case its nil.Position