Solved Checking if a player is holding 1 or multiple 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!

Slacker201

Member
Jul 22, 2024
4
0
1
I need to check if a player is holding 1 or more of an item. I've searched all over and I can't find anything about it.
Code:
on right click:
    if the player is holding 2 prismarine crystals named "&aBandaids":
        draw 150 of dust using dustOption(rgb(254, 112, 170), 1) 1 block above the player with offset vector(0.5, 0.5, 0.5) with extra 0.5
        apply potion of regeneration of tier 1 without any particles to the player for 10 seconds
        remove 1 prismarine crystal named "&aBandaids" from the player's inventory
 
Last edited:
How? This is my current code. (Should have put in the post)
Code:
on right click:
    if the player is holding 2 prismarine crystals named "&aBandaids":
        draw 150 of dust using dustOption(rgb(254, 112, 170), 1) 1 block above the player with offset vector(0.5, 0.5, 0.5) with extra 0.5
        apply potion of regeneration of tier 1 without any particles to the player for 10 seconds
        remove 1 prismarine crystal named "&aBandaids" from the player's inventory
 
How? This is my current code. (Should have put in the post)
Code:
on right click:
    if the player is holding 2 prismarine crystals named "&aBandaids":
        draw 150 of dust using dustOption(rgb(254, 112, 170), 1) 1 block above the player with offset vector(0.5, 0.5, 0.5) with extra 0.5
        apply potion of regeneration of tier 1 without any particles to the player for 10 seconds
        remove 1 prismarine crystal named "&aBandaids" from the player's inventory
Mb, the solution I previously offered didn't work. After a bit of testing, simply set the player's held item to a variable then check if the number of that variable in the player's inventory is greater than a specified number.

Code:
set {_n} to player's tool
if number of {_n} in player's inventory >= 1:
   # Do stuff