# # Get Item Attribute
# gets the 'amount' of an attribute on an item, if the item doesn't have that attribute, it returns <none>.
function getItemAttribute(item: item, attribute: string) :: object: # number doesn't work
set {_nbt} to (nbt compound of {_item})
set {_attributes::*} to (compound list tag "AttributeModifiers" of {_nbt})
loop {_attributes::*}:
if (string tag "Name" of loop-value) is {_attribute}:
set {_amount} to (int tag "Amount" of loop-value)
return {_amount}
command /getItemAttribute:
permission: op
trigger:
set {_i} to player's held item
set {_value} to getItemAttribute({_i}, "generic_max_health")
send "%{_value}%"
Hey there, im working on a attributes skript, basically trying to find attributes per gear piece
But uh {_value} keeps returning "<none>"
I also double checked that the armor piece that im holding has 1 max health, but it does not seem to detect it
