How to give items that can only break certain blocks

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

Pexien

New Member
Aug 10, 2017
2
3
3
I am coding a adventure script for my server, and I want to give the player's a diamond pickaxe that can only destroy sponge. How do you add the canDestroy tag in skript? Ir would also be good if I could give players sponge blocks that could only be placed on certain blocks in skript. Is there any way to do this without having console have to execute the command?
 
So.... I don't know much about NBT, but you could write a simple skript like this
code_language.skript:
on break:
    if player's tool is a diamond pickaxe:
        if lore of player's tool contains "your lore here":
            if event-block is not sponge:
                cancel event
                send "some message about not being able to break blocks"
I suggest using LORE because a player can easily change the name of a tool in game and mess up this system

As for the placing, very similar
code_language.skript:
on place of sponge:
    if lore of player's tool contains "lore of your sponge here":
        if targeted block is not (whatever block you want the sponge to be placed on):
            cancel event
            send "some message about not being able to place sponges here"

I dont think this is really the BEST answer.... but this will give you some insight on some simple solution to fix this issue
 
Do you mean when a player is in adventure mode?
If you mean that you can use this:
code_language.skript:
add "{CanDestroy:["diamond_ore"]}" to nbt of player's tool
It requires SkStuff.
 
  • Like
Reactions: ShaneBee
Status
Not open for further replies.