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!
You can always check out skUnity Downloads for downloads and any other information about Skript!
set {_layer} to 255.5
loop 255 times:
set blocks within chunk at event-block where [block input is not bedrock] where [y-coord of block input is {_layer}] to air
remove 1 from {_layer}
wait 1 tick
doing it one time is fine but 255 times? I'm more than sure this will lag your server.the layer starts at 255.5 because the y-coord of a block is always something.5code_language.skript:set {_layer} to 255.5 loop 255 times: set blocks within chunk at event-block where [block input is not bedrock] where [y-coord of block input is {_layer}] to air remove 1 from {_layer} wait 1 tick
na i tested itdoing it one time is fine but 255 times? I'm more than sure this will lag your server.
it might be normal for a player within a local server (no latency), but what about a server with i.e: 50 players? 50 of which let's say 13 execute this effect, don't you think it will lag if 13 personsa re doing it within the same amount of time?.na i tested it
no i dont think itll lag because its only setting 1 layer of blocks to air at one time which isnt alot. idk if you saw in the other thread where he wanted the whole chunk set at once and it still didnt lag muchit might be normal for a player within a local server (no latency), but what about a server with i.e: 50 players? 50 of which let's say 13 execute this effect, don't you think it will lag if 13 personsa re doing it within the same amount of time?.
I saw it however, it's the same case, it will have a different impact with many players executing it. Your code has to go through all the blocks in the chunk, check if they aren't air nor bedrock, and then set these blocks to air, the calculation itself could be expensive at some point.no i dont think itll lag because its only setting 1 layer of blocks to air at one time which isnt alot. idk if you saw in the other thread where he wanted the whole chunk set at once and it still didnt lag much
That's because the code donut gave you loops every single block in the chunk 255 times each. It will still set the same number of blocks but it will loop a lot more.I tested it and when I make it to set the whole chunk to air it creates less lag that a layer at a time
set {_layer} to 255.5
loop 255 times:
set layer {_layer} of chunk at event-block
remove 1 from {_layer}
wait 1 tick