Generator drop skript makes server lag

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

_BraydenKing

Member
May 12, 2021
13
0
1
22
Hi, I'm trying to create a generator drop skript for my generators. I have found out a way for it to work.. but the only problem is that it really makes the server lag. Anyone know how to fix this? The {generator::1::verify::*} variable is the generator's location and then the player's name. The level options are the items the generators drop.

There is no errors on reload and everything works but is super laggy.

Code:
options:
    level1: wheat
    level2: red mushroom
    level3: melon slice
    level4: pumpkin pie
    level5: coal
    level6: redstone
    level7: iron ingot
    level8: copper ingot
    level9: gold ingot
    level10: diamond
    level11: emerald
    level12: netherite ingot
    level13: prismarine crystals
    level14: glowstone dust
    level15: magma cream

every 100 ticks in "Plots":
    loop all players:
        loop all blocks in radius 25 around loop-player:
            if {generator::1::verify::*} contains "%loop-block's location% . %loop-player%":
                drop {@level1} 0.5 meters above loop-block's location
            if {generator::2::verify::*} contains "%loop-block's location% . %loop-player%":
                drop {@level2} 0.5 meters above loop-block's location
            if {generator::3::verify::*} contains "%loop-block's location% . %loop-player%":
                drop {@level3} 0.5 meters above loop-block's location
            if {generator::4::verify::*} contains "%loop-block's location% . %loop-player%":
                drop {@level4} 0.5 meters above loop-block's location
            if {generator::5::verify::*} contains "%loop-block's location% . %loop-player%":
                drop {@level5} 0.5 meters above loop-block's location
            if {generator::6::verify::*} contains "%loop-block's location% . %loop-player%":
                drop {@level6} 0.5 meters above loop-block's location
            if {generator::7::verify::*} contains "%loop-block's location% . %loop-player%":
                drop {@level7} 0.5 meters above loop-block's location
            if {generator::8::verify::*} contains "%loop-block's location% . %loop-player%":
                drop {@level8} 0.5 meters above loop-block's location
            if {generator::9::verify::*} contains "%loop-block's location% . %loop-player%":
                drop {@level9} 0.5 meters above loop-block's location
            if {generator::10::verify::*} contains "%loop-block's location% . %loop-player%":
                drop {@level10} 0.5 meters above loop-block's location
            if {generator::11::verify::*} contains "%loop-block's location% . %loop-player%":
                drop {@level11} 0.5 meters above loop-block's location
            if {generator::12::verify::*} contains "%loop-block's location% . %loop-player%":
                drop {@level12} 0.5 meters above loop-block's location
            if {generator::13::verify::*} contains "%loop-block's location% . %loop-player%":
                drop {@level13} 0.5 meters above loop-block's location
            if {generator::14::verify::*} contains "%loop-block's location% . %loop-player%":
                drop {@level14} 0.5 meters above loop-block's location
            if {generator::15::verify::*} contains "%loop-block's location% . %loop-player%":
                drop {@level15} 0.5 meters above loop-block's location