Solved amount of click item in inventory of player

  • 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!

KimTsupo

Member
Aug 6, 2023
2
1
1
Hello. I have question.

In my code:
on right click:

set {_temp} to click item
set {_tempnum} to amount of click item in inventory of player

message "%{_temp}%, %{_tempnum}%:


question:
For example, when I clicked dirt, {_temp] is printed dirt in my chat
However even though I have dirt in my inventory, {_tempnum} only printed 0 in my chat
What's wrong?
 
Hello. I have question.

In my code:
on right click:

set {_temp} to click item
set {_tempnum} to amount of click item in inventory of player

message "%{_temp}%, %{_tempnum}%:


question:
For example, when I clicked dirt, {_temp] is printed dirt in my chat
However even though I have dirt in my inventory, {_tempnum} only printed 0 in my chat
What's wrong?
Firstly, don't forget to format your code. If your checking for the amount of X item the player is clicking, it's best to rewrite the set {_tempnum} line so that instead of "amount of click item" it would be "amount of {_temp}". Also if you want to make that line shorter (The one with {_tempnum}) you could replace "inventory of player" with a more simpler "player's inventory". Hope this helps!
 
Thank you for reply!

In my case, the error is caused by NBT tag.

So it was solved when I changed {_temp} to click item → {_temp} to type click item
 
  • Like
Reactions: Luke_Sky_Walker