Problem getting Item Script to work

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

Debux

Member
Aug 27, 2021
1
0
1
29
Hello, I am trying to create an item that stays enchanted for 3 uses, and once they're used up the item disenchants. However, my script breaks after the first use- it seems that after the item is enchanted the 'use system' stops working and the sword remains enchanted. Any ideas?


Code:
Variables:
    {crucible.%player%} = 3



on rightclick:
    if player's held item is netherite sword named "Crucible":
        set {crucible.%player%} to 3

on leftclick:
    if player's held item is netherite sword named "Crucible":
        if {crucible.%player%} is 3:
            send "hello" to player
            subtract 1 from {crucible.%player%}
        else if {crucible.%player%} is 2:
            send "hello2" to player
            subtract 1 from {crucible.%player%}
        else if {crucible.%player%} is 1:
            send "hello3" to player
            subtract 1 from {crucible.%player%}
        else if {crucible.%player%} is 0:
            send "EMPTY" to player

on leftclick:
    while player's held item is netherite sword named "Crucible":
        if {crucible.%player%} = 3:
            send action bar "&k&C━| ━ |━" to player
            if player's tool is not enchanted:
                enchant player's held item with sharpness 5
                enchant player's held item with knockback 3
                enchant player's held item with sweeping edge 5
                enchant player's held item with fire aspect 1
                enchant player's held item with smite 10
                enchant player's held item with bane of arthropods 10
            wait 2 seconds
        else if {crucible.%player%} = 2:
            send action bar "&k&C━| ━ | " to player
            wait 2 seconds
        else if {crucible.%player%} = 1:
            send action bar "&k&C━|   | " to player
            wait 2 seconds
        else if {crucible.%player%} = 0:
            send action bar "&k&C |   | " to player
            disenchant the player's tool
            wait 2 seconds
 
ohoh... please don't use variables for item specific stuff. To create custom enchants, you can use TuSKe. If you don't want to use that, use metadata for stuff like this. There are some tutorials on here with SkBee.
 
Status
Not open for further replies.