1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Help with right click

Discussion in 'Skript' started by Lucazz, Mar 29, 2022.

Thread Status:
Not open for further replies.
  1. Lucazz

    Lucazz Member

    Joined:
    Mar 29, 2022
    Messages:
    12
    Likes Received:
    0
    Hi , I have a problem with right click, basically , when a player right click with the item, it does work well, but if the items are 2, it does not work.

    Code (Text):
    1. on right click on dirt:
    2.     if tool of player is stick:
    3.         if name of tool of player is "example":
    4.             make console execute "economy give %player% 2"
    5.     else if tool of player is paper:
    6.         if name of tool of player is "other example":
    7.             send "Hello World"
    8.             remove 1 paper named "other example" from the player


     
  2. Best Answer:
    Post #7 by Jake*, Apr 17, 2022
  3. Mich

    Mich Active Member

    Joined:
    Jul 15, 2020
    Messages:
    148
    Likes Received:
    5
    try using a this condition something like player has 1 paper
    https://docs.skriptlang.org/conditions.html#CondCanHold
     
  4. yea rite

    yea rite Active Member

    Joined:
    Jul 11, 2021
    Messages:
    82
    Likes Received:
    8
    You can debug your code by put a broadcast effect after every if statement, to see where its stopping. You can also use
    Code (Text):
    1. on right click:
    2.   broadcast "%name of held item%"
    to find what skript thinks the item names are
     
  5. Lucazz

    Lucazz Member

    Joined:
    Mar 29, 2022
    Messages:
    12
    Likes Received:
    0
    Skript identifies item as (number of blocks) (name of block) , I dont know why it doenst work in my code
     
  6. yea rite

    yea rite Active Member

    Joined:
    Jul 11, 2021
    Messages:
    82
    Likes Received:
    8
    use 'contains' instead of 'is'
    Code (Text):
    1. name of player's tool contains "example"
     
  7. Lucazz

    Lucazz Member

    Joined:
    Mar 29, 2022
    Messages:
    12
    Likes Received:
    0
    nope, still nothing..
     
  8. Jake*

    Supporter

    Joined:
    Jan 30, 2022
    Messages:
    117
    Likes Received:
    6
    Hi! I've read your discussion a bit, after some time i found this to be the easiest way to make what you wanted!
    I tested it and there should not be any problems with right clicking with more than 1 item.

    Code (Text):
    1. on right click on dirt:
    2.   if player's tool is a stick:
    3.     if name of player's tool contains "example":
    4.       make console execute "economy give %player% 2"
    5.   else if player's tool is a paper:
    6.     if name of player's tool contains "other example":
    7.       send "Hello World"
    8.       remove 1 of player's tool from player if name of player's tool contains "other example"
    Let me know if this helped and remember to make this reply as the Best Answer as well as making the thread as Solved!

    Have a nice day!
     
  9. Lucazz

    Lucazz Member

    Joined:
    Mar 29, 2022
    Messages:
    12
    Likes Received:
    0
    Thank you, worked
     
  10. Jake*

    Supporter

    Joined:
    Jan 30, 2022
    Messages:
    117
    Likes Received:
    6
    Happy to hear that!
     
Thread Status:
Not open for further replies.

Share This Page

Loading...