Solved On Inventory Click

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

SmallDev

Member
Apr 6, 2020
39
0
6
So I'm making a gui, and I need to be able to detect when something is clicked, I've tried
Code:
on inventory click:
    if inventory name of current inventory of player is "Shop":
        if clicked slot is 12:
            send "Hi" to player

But I get no return when clicking slot 12.
 
Hey SmallDev,

Have you tried debugging your code?
It may be that the names are different?

Also, try:
Code:
on inventory click:
  name of event-inventory is "Shop"
  cancel event
  send "hi"

I hope this helps!
 
The names are the same, this is the opening code
Code:
command /shop:
    trigger:
        open virtual chest inventory named "shop" to player
        create a gui slot 12 of player with glowing gold ingot named "&2&lIn Game BuyCraft" with Lore "&7Stuff you can buy in /buy, but with in-game currency"
        create a gui slot 13 of player with glowing iron sword named "&c&lKits" with Lore "&7Buy Em Here"
        create a gui slot 14 of player with glowing gold block named "&6&lStore" with Lore "&7Gives you buycraft link"
The code you sent didn't work, thanks :emoji_grinning:
[doublepost=1596590675,1596582073][/doublepost]Oh and I changed the name of event-inventory is "Shop" to "shop", and it still didn't work.
[doublepost=1596592147][/doublepost]I found out I should be using
Code:
command /shop:
    trigger:
        open virtual chest inventory named "shop" to player
        create a gui slot 12 of player with glowing gold ingot named "&2&lIn Game BuyCraft" with Lore "&7Stuff you can buy in /buy, but with in-game currency" to run:
##stuff
 
Status
Not open for further replies.