Hello guys, I have this skript:
how to optimize? I have 5 GB RAM server and it's still lagging
code_language.skript:
function SaveArea(t: text):
set {_x} to 0
loop blocks within {arena.pos1.%{_t}%} to {arena.pos2.%{_t}%}:
if loop-block is not air:
add 1 to {_x}
set {arena::%{_t}%::blocklar::%location of loop-block%} to type of block at loop-block
if {_x} is 100:
wait 1 ticks
set {_x} to 0
function Restore(t: text):
set {_x} to 0
set {_y} to 0
wait 0.3 seconds
loop blocks within {arena.pos1.%{_t}%} to {arena.pos2.%{_t}%}:
if {arena::%{_t}%::blocklar::%location of loop-block%} is set:
if type of loop-block is not {arena::%{_t}%::blocklar::%location of loop-block%}:
add 1 to {_x}
set block at loop-block to {arena::%{_t}%::blocklar::%location of loop-block%}
if {_x} is 80:
wait 3 ticks #THIS IS AN ANTI-LAG SISTEM IF, CHANGE AT YOU RISK
set {_x} to 0
else:
if loop-block is not air:
set block at loop-block to air
if {_y} is 4:
wait 5 ticks
set {_y} to 0
command /setpos1 [<text>]:
permission: sw.op
trigger:
if arg 1 is set:
set {arena.pos1.%arg-1%} to location of player
message "{@prefix} pos1 set for %arg-1%"
command /setpos2 [<text>]:
permission: sw.op
trigger:
if arg 1 is set:
set {arena.pos2.%arg-1%} to location of player
message "{@prefix} pos2 set for %arg-1%"
command /save [<text>]:
permission: sw.op
trigger:
SaveArea("%arg-1%")
message "{@prefix} arena %arg-1% saved."
command /restore [<text>]:
permission: sw.op
trigger:
Restore("%arg-1%")
message "{@prefix} arena %arg-1% restored."
how to optimize? I have 5 GB RAM server and it's still lagging