Different models of iPad support different Apple Pencils. Here is Apple's definitive compatibility list for Apple Pencil and iPad:
Apple Pencil compatibility - Apple Support
Outside of the stated compatibility, Pencils are not interchangeable.
Assuming that your iPad and Pencil are compatible, ensure that the user-replaceable Pencil tip is snugly screwed into the body of the Apple Pencil; when fitted correctly you should see a tiny gap, of about the thickness of a sheet of paper, between the tip and pencil body. If slightly loosened, or overtightened, the Pencil may not work properly, if at all.

Be aware that if your iPad screen has ever been replaced by anyone other than Apple, the screen will not be properly calibrated; this situation is known to cause issues with the Pencil. Also, if the Pencil has been dropped onto its tip, or if the tip has been subjected to unnecessary force, the transducer element that its located beneath the replaceable plastic tip may have been damaged; a damaged Pencil cannot be repaired - only replaced.
If you need assistance, the technicians at the Genius Bar of your local Apple Store or Apple Authorised Service Provider (AASP) will be able to fully test and assess your iPad and Apple Pencil:
Genius Bar Reservation and Apple Support Options - Apple