Need help with how to make item craftable only once

  • 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 community!

    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!

Pixco

Member
Aug 19, 2024
2
1
3
I’m working on a custom tp pearl but I need to to be craftable only once in an entire server can you guys help? I’m really new to this.
this is the code so far just in case u need it :
code_language.skript:
on load:
    register new shaped recipe for enderpearl named "&a&lTP PEARL" with lore "You can tp anywhere every 10 seconds" using beacon, dragon head, beacon, grass block, enderpearl, netherrack, beacon, elytra, beacon

command /tppearl <x>, <y>, <z>, <world>:
    cooldown: 10 minutes
    cooldown message: You are on cooldown
    trigger:
        if player's held item is enderpearl named "&a&lTP PEARL" with lore "You can tp anywhere every 10 seconds":
            teleport player to location(arg-1, arg-2, arg-3, arg-4)
        else:
            send "&l&eYou do not have the Tp Pearl" to player
            
on rightclick:
    if player's tool is an enderpearl named "&a&ITP PEARL" with lore "You can tp anywhere every 10 seconds":
        cancel event
 
  • Like
Reactions: ApplePenChicken
To make an item only craftable once you should use a variable.

code_language.skript:
Variables:
    {crafted} = false
    
on load:
    set {item} to #what ever item is
    register new shapeless recipe {item} using #recipe

on craft of {item}:
    if {Crafted} is false:
        set {Crafted} to true
    else:
        cancel event
        send "&eThis item has already been crafted!"

Hopefully this works for you!
This code has not been tested.