$item modify entity @s weapon.mainhand \ {\ function:set_components, \ components: {\ "minecraft:custom_model_data": { "strings": [ $(Model) ] } \ }\ } $title @s actionbar [{"text": "Set Custom Model Data to ", "color": "green"},{"text": "$(Model)", "color": "aqua"}] execute at @s run playsound minecraft:entity.villager.work_cartographer player @s ~ ~ ~ 0.6 0.6