Jump to content

Why does this happen?


mascat102

Recommended Posts

I'm trying to change my multiplier skript to something else and I got this.

on break:
    if player's tool is enchanted with multishot 1:
        add drops of event-block to {blocks::*}
        clear drops
        loop {blocks::*}:
            give loop-value to player
            give loop-value to player
            stop
            

Though whenever I break a block it just uses the first block I broke. So if I broke wood first anytime I use a tool with multishot it will give me wood. I can't see the problem or why this is happening because I recently started learning skript. I am wondering if anyone knows how to fix it.

Link to comment
Share on other sites

The issue is that you're storing the drops in the list {blocks::*} but not resetting it before each break event, leading to it retaining only the first block's drops. You need to clear {blocks::*} at the beginning of the event handler. Here’s the corrected script:

on break:
 clear {blocks::*}
 player's tool is enchanted with multishot 1
 add drops of event-block to {blocks::*}
 clear drops
 loop {blocks::*}:
  give loop-value to player
  give loop-value to player
 stop

Edited by gabinun
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...