[Skript] On villager right click give item

Discussion in 'Skript' started by TheWolfiiii, Mar 7, 2020.

Thread Status:
Not open for further replies.
  1. Hello! I need help with my script. One second it worked and another second it doesn't.
    Please help.
    Here is the code:
    Code (Text):
    on rightclick on villager:
        if name of villager is "Cocain Dealer":
            if tool of player is not iron nugget:
                if name of tool of player is not "Cocain NKey":
                    send "&c You Need A Cocain Key To Get Cocain" to player
        else:
            if name of villager is "Cocain Dealer":
                if tool of player is iron nugget:
                    if name of tool of player is "Cocain Key":
                        give 1 sugar named "&fCocain (5 gram per item)" to player
    Could anyone help me solve this issue. Thanks!
     
    #1 TheWolfiiii, Mar 7, 2020
    Last edited: Mar 7, 2020
  2. Hello, maybe you failed to place the "else", however the code should be:

    Code (Text):
    on rightclick on villager:
        if name of villager is "Cocain Dealer":
            if player's tool is iron nugget:
                if name of tool of player is not "Cocain NKey":
                    send "&c You Need A Cocain Key To Get Cocain" to player
                else:
                    if name of villager is "Cocain Dealer":
                        if player's tool is iron nugget:
                            if name of tool of player is "Cocain Key":
                                give 1 sugar named "&fCocain (5 gram per item)" to player    
    Hope it helped :)
     
  3. It still doesn't work. I don't know what is wrong. When I reload the file it says it reloaded successfully but nothing happens when I click the villager... There's no error messages or anything...
     
  4. Which version of Skript are you using?
    Did you instal any addon?
     
  5. I'm not really sure if this is the versionof skript but this is what I found in the config. Version: 2.4.1-MH. I do not have any addons installed
     
  6. I Think that you typed wrong the if/else statement
    Code (Text):
        if name of villager is "Cocain Dealer":
            if tool of player is not iron nugget:
                if name of tool of player is not "Cocain NKey":
                    send "&c You Need A Cocain Key To Get Cocain" to player
        else if name of villager is "Cocain Dealer":
            if tool of player is iron nugget:
                if name of tool of player is "Cocain Key":
                    give 1 sugar named "&fCocain (5 gram per item)" to player
    and what error do you get?
     
  7. I tried your code and it still doesn't work. It says "Reloaded successfully" but when I right click on the villager named "Cocain Dealer" nothing happens. No error code or anything
     
  8. Alright. I managed to get the part where if I don't have a cocain key he will say I need one to work. But the part where if I have a cocain key is still not working. No errors, no nothing. No idea how to solve this...
     
  9. I really don't know what happened. One minute it was working perfectly fine, and then the other it is completely broken.
     
  10. I recommend you to install the right version of Skript
    https://github.com/SkriptLang/Skript/releases
     
  11. I tried that code and that worked well.
     
  12. The problem is I'm using minehut and they have custom versions of skript. Im not sure if I can do anything
     
  13. Which is the minecraft version?
     
  14. 1.15.2
     
  15. Then I'd say it's a bug, In 1.14.4 works fine.
     
  16. Alright. Thanks for the help.
     
  17. try: uncolored name of clicked entity instead of name of villager
     
Thread Status:
Not open for further replies.