remove 1 item from stack of hand (crash)

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

ililedie

New Member
Feb 19, 2021
7
0
1
Code:
on rightclick holding yellow dye:
  player's tool is not yellow dye named "asd" with lore "123":
    stop
  remove 1 of event-item from player's inventory
  send "&f3" to player
  wait 5 ticks
  send "&e2" to player
  wait 5 ticks
  send "&61" to player
  wait 5 ticks
  add "a" to {_rew::*}
  add "b" to {_rew::*}
  add "c" to {_rew::*}
  set {_rew} to random element of {_rew::*}
  make console execute command "/kit %{_rew}% %player%"
  send "ok" to player

I made this imitating an old script (made with skript for minecraft 1.5.2), and it works fine with the latest skrip version on spigot 1.16.4, but I find 2 problems:
1. The item in the player's hand is removed but if it is greater than 2 or is a stack, the script does nothing.
2. the script crashes the server, but it is random times, I would say that when using the yellow dye about 10 times
-I have tried to look for information in other sites but in github I found that it was due to a skript bug itself, and the problem was marked as medium priority, but don't know if it has been solved so far, is it possible that I am doing something wrong, can anyone tell me which lines I should change?
 
Hi. Try checking if the first conditional statement on line 2 is preventing it from running; adding a debug message before it stops. My assumption, without testing it myself, is that line is requiring it to be specifically 1 yellow dye that matches the description. If that is the case, just check the name and lore of the item, and don't compare it to an entire itemstack.

Also, I'd recommend not referring to your Skript version as "latest", as it's discouraged on the forum.

Hope this helped.
 
Status
Not open for further replies.