Solved Help with right 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.

Lucazz

Member
Mar 29, 2022
12
0
1
23
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:
on right click on dirt:
    if tool of player is stick:
        if name of tool of player is "example":
            make console execute "economy give %player% 2"
    else if tool of player is paper:
        if name of tool of player is "other example":
            send "Hello World"
            remove 1 paper named "other example" from the player
 
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:
on right click on dirt:
    if tool of player is stick:
        if name of tool of player is "example":
            make console execute "economy give %player% 2"
    else if tool of player is paper:
        if name of tool of player is "other example":
            send "Hello World"
            remove 1 paper named "other example" from the player
try using a this condition something like player has 1 paper
https://docs.skriptlang.org/conditions.html#CondCanHold
 
You can debug your code by put a broadcast effect after every if statement, to see where its stopping. You can also use
Code:
on right click:
  broadcast "%name of held item%"
to find what skript thinks the item names are
 
You can debug your code by put a broadcast effect after every if statement, to see where its stopping. You can also use
Code:
on right click:
  broadcast "%name of held item%"
to find what skript thinks the item names are

Skript identifies item as (number of blocks) (name of block) , I dont know why it doenst work in my code
 
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:
on right click on dirt:
  if player's tool is a stick:
    if name of player's tool contains "example":
      make console execute "economy give %player% 2"
  else if player's tool is a paper:
    if name of player's tool contains "other example":
      send "Hello World"
      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!
 
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:
on right click on dirt:
  if player's tool is a stick:
    if name of player's tool contains "example":
      make console execute "economy give %player% 2"
  else if player's tool is a paper:
    if name of player's tool contains "other example":
      send "Hello World"
      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!
Thank you, worked
 
Status
Not open for further replies.