Code not detecting items

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

DPPPPP

Member
Jul 22, 2023
27
0
1
CODE:
command /AdvancedCrafting <int>:
trigger:
if the argument is 1:
send "check1" to the player
if the player's inventory contains 2 stone button with name "&eCoin" with lore "" and "&cLegendary Item" and 1 stone axe with name "axe of peace":
remove 2 stone button with name "&eCoin" with lore "" and "&cLegendary Item" from the player's inventory
remove 1 stone axe with name "axe of peace" from the player's inventory
give 1 iron sword with name "&dAtomsplit &eSword" to the player
send "&aSuccesful!" to the player
if the player doesn't contain 2 stone button with name "&eCoin" with lore "" and "&cLegendary Item" and 1 stone axe with name "axe of peace":
send "&4Error 001: Insufficient Materials" to the player

Problem:
I have said items in my inventory but it wont detect them even when spawned in with copy paste.
(2 stone button with name "&eCoin" with lore "" and "&cLegendary Item") is spawned in with the same exact code but still won't work.
 
CODE:
command /AdvancedCrafting <int>:
trigger:
if the argument is 1:
send "check1" to the player
if the player's inventory contains 2 stone button with name "&eCoin" with lore "" and "&cLegendary Item" and 1 stone axe with name "axe of peace":
remove 2 stone button with name "&eCoin" with lore "" and "&cLegendary Item" from the player's inventory
remove 1 stone axe with name "axe of peace" from the player's inventory
give 1 iron sword with name "&dAtomsplit &eSword" to the player
send "&aSuccesful!" to the player
if the player doesn't contain 2 stone button with name "&eCoin" with lore "" and "&cLegendary Item" and 1 stone axe with name "axe of peace":
send "&4Error 001: Insufficient Materials" to the player

Problem:
I have said items in my inventory but it wont detect them even when spawned in with copy paste.
(2 stone button with name "&eCoin" with lore "" and "&cLegendary Item") is spawned in with the same exact code but still won't work.
Solution: Use loops. Instead of checking if player has X amount of item and such, it would be much better to simply loop all slots in the player's inventory, check if one of those slots is the target item(s) then run your desired code if conditions are met. This would also likely shorten your code too.