Running sound on inventory open

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

JohniClark

Member
Feb 19, 2017
31
2
0
25
Could someone show me how to play a sound when someone opens his inventory.
i tried this code but it didnt work:
code_language.skript:
on inventory open:
    play "block chest open" at event-player
i says that there is not player in an inventory open event
 
You need RandomSK or the Bensku's fork to do so. But evenly with an event-player, this wouldn't work such as the inventory open event isn't triggered when players opens their inventories, but inventories such as chests, dispensers, etc.

To properly do this you'll need MundoSK (and ProtocolLib) or Skellett. With them, you'll be able to do the following:
code_language.skript:
on packet event play_client_client_command:
    if "ClientCommand" penum 0 of event-packet is equal to "OPEN_INVENTORY_ACHIEVEMENT":
        #play the sound here
code_language.skript:
on packet:
    if event-string is equal to "PlayInClientCommand":
        if "%packet field ""a""%" is equal to "OPEN_INVENTORY_ACHIEVEMENT":
            #play the sound here
 
Status
Not open for further replies.