I was trying to know about the strong nuclear force within the nucleus and the books and websites told me that it is the gluons which carry the force, and now I am curious how the gluons carry this force
As in your profile you say you are a ninth class student in India, it means that your physics background is still at understanding the classical physics level.
The strong nuclear force and the strong force of particle physics belong to the quantum mechanical studies, which I doubt it is taught in your year.
In classical physics force can be defined as the change in momentum in time, $F=dp/dt$. At the level of nuclei and particles, this is the only reasonable definition of a force, because any interaction between quantum mechanical entities happens by the exchange of an elementary particle which transfers energy and momentum and quantum numbers ( which you will eventually learn about) between the quantum mechanical entities, be they nuclei or particles.
Think of two boats in a quiet sea. If one boat throws a ball to the other, they interact with the $dp/dt$ the ball carries. That is how forces are to be defined in the micro level of nuclear and particle physics. In this answer here , there is an illustration of the boats with a boomerang thrown, to show an analogy with attractive forces. ( the feynman diagrams are for later in your education, if you still like physics and pursue it)
The elementary particles carrying the force to first order in most interactions are:
the photon, for electromagnetic interactions
the Z and W for weak interactions
the gluon for strong interactions
For nuclei, which are bound states of protons and neutrons, the strong nuclear force, is a spill over force from the strong force which has the gluon as a force carrier . Interaction of nuclei can be modeled by having the composite hadron particle pion as a force carrier.
Protons (and neutrons and other hadrons) are an entity with three valence quarks held together by an innumerable number of gluons as force carriers, because gluons are very attractive to quarks and to each other. ( the word comes from glue)
Here is an illustration of a proton:
The three valence quarks are lost in the plethora of gluons and quark antiquark pairs created by the mechanism of strong interactions.
The strong force is so strong that new quantum mechanical models have been developed to explain the hadrons ( bound states of quarks by gluons), called QCD on the lattice.