Help with lag on my project

When i kill all enemy’s the game gets very laggy, can someone help with that:

Hi @OrangeGlowest, first of all what an awsome game you’ve made!

The lag is caused because you added an event (yellow block) inside a forever loop in the servants ai, it is also embedded here in a “run parralel” block where the parallel action preformed is that the servants (if alive) walk for 1 second. The forever loop will wait until the tasks within the loop are completed before looping, meaning it will wait (aslong as any of the servants are alive) for 1 second, but when all of them are dead and therefor none of the 1 second walk blocks go off, the loop will reassign the servant’s events as fast as the computer can; This can be 10s or even 100s of times per second, causing a huge amount of lag.

I’ve gone ahead a rewritten the ai code to make it a bit more readable and so that the computer only ever needs to write 1 event for each servant. Hopefully you can figure out how my version works; If you have any questions do let me know.

And success with the game, looking forward to seeing more of it!

1 Like

sir, you are a legend!

1 Like

you also unintentionally fixed the people falling down, it was broken, thanks!

Its based off of the Hypixel Skyblock Scarf Battle F2

1 Like