Solved Help with checking if player has a item in offhand or in inventory

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

    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!

Status
Not open for further replies.

SquidR

New Member
Jan 28, 2021
6
0
1
19
how can i make it so that skript detects if a player has an item in offhand or in inventory, i've tried
if player's offhand is stone named "&6Test":
add flint named "&7Pebble" to player's inventory
and if player has stone named "&6Test" in inventory:
but its not working
 
You require a trigger or event for it to work, you need to start off with a trigger.

Code:
every 1 second:
  loop all players:
    if player's offhand is stone named "&6Test":
      give loop-player 1 flint named "&7Pebble"

vice versa, you can use the same loop to check if it's in their inventory.

Code:
every 1 second:
  loop all players:
    if player's inventory contains stone named "&6Test":
      give player 1 flint named "&7Pebble"
 
Status
Not open for further replies.