#Skript Optimization
1 messages · Page 1 of 1 (latest)
well we have no way of knowing how to optimize it when we know nothing about your skript 🤦♂️
send your skript
The issue is that each time a player mines another forever loop is added
The previous loops won't stop unless you make it
So since you have a huge amount of forever loops running all at the same time, it lags out the server
Not sure why you even need loops. You could just do on item pickup: without loops or something similar
Also, double check your indentation in the first code block
@pale tinsel
Each loop is for a certain block of a certain mine. That's why there are so many.
And that makes a lot of sense, I'll see if I can see how not to overload the script.
Loops are things like while player is online: or loop all players:
I am not talking about each block and its compressed counterpart
Loops are unnecessary here and you could make the compression trigger on something else other than a loop
I already explained how to not overload the skript just read the sentence above
Instead of
while player is online:
wait 1 second
if {AutoComp::%player's uuid%} = true:
insert code here```
You can do
```on item pickup:
if {AutoComp::%player's uuid%} = true:
insert code here```
This gets rid of:
- adding more and more of the same loop
- the loop itself (forever loops can lag your server)
- 2 lines of code
Hopefully this helps you optimize code in the future
Thank you very much for taking the time to analyze my problem!
on item pickup: This structure tells me that you don't understand it.
O
Not exactly sure what you're trying to do with this then but just remember the main cause of the crashes is because it's adding more and more infinity loops over time
if {AutoComp::%player's uuid%} = true:
insert code here
cancel event```
This maybe work? I understood what you explained to me, I learn as I go.
That's why that code is so messy.
fix the indentation
Okay, but would it be correct that way so that it is not infinite?
there aren't even any loops at all
so yes
not sure why you have cancel event though
then people cant get items at all
god i love hardcoding