so my code looks like this. it worked on 1.20 but no longer works on 1.21. it would give a random item before but now always uses the same item.
on right click:
if player's held item is gray dye named "&c&lRandom Crystal":
set {randomcrystal::%player%} to a random integer out of 1,2,3,4,5,6,7,8,9 or 10
remove 1 gray dye named "&c&lRandom Crystal" from player's inventory
if {randomcrystal::%player%} is 1:
give player amethyst shard named "&bᴄʀʏᴏ sʜᴀʀᴅ" with custom model data 95 with lore "&9-----------------------", "&7Damaging your enemies has", "&7a chance to &b&lFreeze &7them!", "&9-----------------------", "&b&lCold &7biomes buff you!", and "&9-----------------------"
if {randomcrystal::%player%} is 2:
give player amethyst shard named "&fᴀɴᴇᴍᴏ sʜᴀʀᴅ" with custom model data 91 with lore "&9--------------------", "&7No fall damage!", "&9--------------------", "&7Crits from a tall height", "&7does more &c&lDamage!", and "&9--------------------"
if {randomcrystal::%player%} is 3:
give player amethyst shard named "&6ᴘʏʀᴏ sʜᴀʀᴅ" with custom model data 89 with lore "&9-------------------------", "&7Permanent &6&lfire resistance!", "&9-------------------------", "&7Do more &c&lDamage &7while in", "&7the &6&lNether &7or on &6&lFire!", and "&9-------------------------"
if {randomcrystal::%player%} is 4:
give player amethyst shard named "&6ɢᴇᴏ sʜᴀʀᴅ" with custom model data 85 with lore "&9----------------------", "&7Permanent resistance!", "&9----------------------", "&7Do more &c&lDamage &7while", "&8&lUnderground!", and "&9----------------------"
if {randomcrystal::%player%} is 5:
give player amethyst shard named "&8ɴᴇᴄʀᴏ sʜᴀʀᴅ" with custom model data 83 with lore "&9----------------------------", "&7Hitting your enemies with a", "&7shovel puts them &5&l6 Feet Under", and "&9----------------------------"
if {randomcrystal::%player%} is 6:
give player amethyst shard named "&fʀᴀᴅɪᴀɴᴛ sʜᴀʀᴅ" with custom model data 81 with lore "&9-------------------------", "&7Permanent &6&lfire resistance!", "&9-------------------------", "&7When low, you have a chance", "&7to push away your &c&lOpps!", and "&9-------------------------"
if {randomcrystal::%player%} is 7:
give player amethyst shard named "&esᴘᴇᴇᴅ sʜᴀʀᴅ" with custom model data 7 with lore "&9-------------------", "&7Permanent &e&lSpeed II!", and "&9-------------------"
if {randomcrystal::%player%} is 8:
give player amethyst shard named "&csᴛʀᴇɴɢᴛʜ sʜᴀʀᴅ" with custom model data 9 with lore "&9---------------------------", "&7Permanent +2 &c&lAttack Damage!", and "&9---------------------------"
if {randomcrystal::%player%} is 9:
give player amethyst shard named "&dᴠɪᴛᴀʟ sʜᴀʀᴅ" with custom model data 3 with lore "&9------------------", "&7+2 extra &d&lHearts!", "&9------------------", "&7Hitting people has a", "&7chance to &d&lheal you!", and "&9------------------"
if {randomcrystal::%player%} is 10:
give player amethyst shard named "&2ᴅᴇɴᴅʀᴏ sʜᴀʀᴅ" with custom model data 49 with lore "&9--------------", "&7Right click twice", "&7to ride a &2&lVine!", and "&9--------------"
on right click:
if player's held item is gray dye named "&c&lRandom Crystal":
set {randomcrystal::%player%} to a random integer out of 1,2,3,4,5,6,7,8,9 or 10
remove 1 gray dye named "&c&lRandom Crystal" from player's inventory
if {randomcrystal::%player%} is 1:
give player amethyst shard named "&bᴄʀʏᴏ sʜᴀʀᴅ" with custom model data 95 with lore "&9-----------------------", "&7Damaging your enemies has", "&7a chance to &b&lFreeze &7them!", "&9-----------------------", "&b&lCold &7biomes buff you!", and "&9-----------------------"
if {randomcrystal::%player%} is 2:
give player amethyst shard named "&fᴀɴᴇᴍᴏ sʜᴀʀᴅ" with custom model data 91 with lore "&9--------------------", "&7No fall damage!", "&9--------------------", "&7Crits from a tall height", "&7does more &c&lDamage!", and "&9--------------------"
if {randomcrystal::%player%} is 3:
give player amethyst shard named "&6ᴘʏʀᴏ sʜᴀʀᴅ" with custom model data 89 with lore "&9-------------------------", "&7Permanent &6&lfire resistance!", "&9-------------------------", "&7Do more &c&lDamage &7while in", "&7the &6&lNether &7or on &6&lFire!", and "&9-------------------------"
if {randomcrystal::%player%} is 4:
give player amethyst shard named "&6ɢᴇᴏ sʜᴀʀᴅ" with custom model data 85 with lore "&9----------------------", "&7Permanent resistance!", "&9----------------------", "&7Do more &c&lDamage &7while", "&8&lUnderground!", and "&9----------------------"
if {randomcrystal::%player%} is 5:
give player amethyst shard named "&8ɴᴇᴄʀᴏ sʜᴀʀᴅ" with custom model data 83 with lore "&9----------------------------", "&7Hitting your enemies with a", "&7shovel puts them &5&l6 Feet Under", and "&9----------------------------"
if {randomcrystal::%player%} is 6:
give player amethyst shard named "&fʀᴀᴅɪᴀɴᴛ sʜᴀʀᴅ" with custom model data 81 with lore "&9-------------------------", "&7Permanent &6&lfire resistance!", "&9-------------------------", "&7When low, you have a chance", "&7to push away your &c&lOpps!", and "&9-------------------------"
if {randomcrystal::%player%} is 7:
give player amethyst shard named "&esᴘᴇᴇᴅ sʜᴀʀᴅ" with custom model data 7 with lore "&9-------------------", "&7Permanent &e&lSpeed II!", and "&9-------------------"
if {randomcrystal::%player%} is 8:
give player amethyst shard named "&csᴛʀᴇɴɢᴛʜ sʜᴀʀᴅ" with custom model data 9 with lore "&9---------------------------", "&7Permanent +2 &c&lAttack Damage!", and "&9---------------------------"
if {randomcrystal::%player%} is 9:
give player amethyst shard named "&dᴠɪᴛᴀʟ sʜᴀʀᴅ" with custom model data 3 with lore "&9------------------", "&7+2 extra &d&lHearts!", "&9------------------", "&7Hitting people has a", "&7chance to &d&lheal you!", and "&9------------------"
if {randomcrystal::%player%} is 10:
give player amethyst shard named "&2ᴅᴇɴᴅʀᴏ sʜᴀʀᴅ" with custom model data 49 with lore "&9--------------", "&7Right click twice", "&7to ride a &2&lVine!", and "&9--------------"