Weaponry, for the purpose of combat or predator defence, is one of the most widespread animal adaptations.
A 2018 paper in Proceedings of the Royal Society, Biological Sciences points out that tail weaponisation (flails, spikes, bats and clubs etc) which is very prevalent in the fossil record, is exceptionally rare in currently living animals.
Bony structures inferred to be weapons are widespread in the fossil record, appearing in pareiasaurs, dicynodonts, rodents, artiodactyls, perissodactyls and non-avian dinosaurs.
The great phenotypic diversity of weapons in living species is known to be influenced by multiple factors including mating system, intensity of sexual selection, fighting style, body size and mechanical constraints. However, rigorous studies attempting to define common ecological or anatomical correlates of weaponry within a broad phylogenetic framework are lacking and no research to our knowledge has attempted to study weaponry broadly in extinct vertebrates."
[source link below]
The study suggests that the extinct animals which had significant tail weapons were likely to have had a specific suite of traits :
"[…] including large body size, body armour (in the form of carapaces, osteoderms or spikes), thoracic stiffness and herbivory."
[source link below]
Given the obvious effectiveness of specially adapted tail weapons, it remains unclear why so few of the current land-based animals have them.
See: The evolution of tail weaponization in amniotes Proceedings of the Royal Society, Biology., 2018