Solved Replace a Block

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

LoneElf

Active Member
Apr 30, 2017
165
2
18
24
Hey there! You are probably seeing my name a lot throughout the help section as I have been having a lot of questions that I wanted to be answered. You guys are awesome! So, my current issue is that I need to replace a block. Now, when I destroy a pumpkin, it destroys it and replaces it with stone, but after 40 ticks, it should go back to a pumpkin which it doesn't. Here is my code:
code_language.skript:
on block break:
        if event-block is a 86:
                set {_newBlock} to event-block
                set event-block to a 4
                event-block.setCustomNameVisible(true);
                event-block.setCustomName(event-block.getItemStack().getItemMeta().getDisplayName() ? "&c&lLOOTED")
                wait 40 ticks
                set {_newBlock} to a 86

So, the pumpkin (86) gets replaced with stone, which is good, but the stone, after 40 ticks, doesn't replace back to a pumpkin.

(the code in the middle that looks like Bukkit Coding is one I am currently asking for help on a different thread for. If you can answer it, that would be great too!)

Thanks a lot guys! :emoji_wink:

Best of Luck,
- @LoneElf
 
That's because you're setting the variable, {_newBlock} to the ID value of the block, not the location. Set it as
code_language.skript:
set {_newBlock} to location at event-block
 
Thanks @White. The problem I have is, I need to remove the block that was currently at {_newBlock} because right now, it keeps the stone and just drops a pumpkin. Is there a way to clear a block that is at {_newBlock}?

Thank you!
[doublepost=1506303653,1506302228][/doublepost]Never mind - I got it to work. I just did: set event-block to 86 to set it back to a pumpkin! :emoji_slight_smile: Thanks!
 
Status
Not open for further replies.