#how to clear large map terrain without causing script exhaust

1 messages · Page 1 of 1 (latest)

neat anchor
#

i have a game that is constantly loading in and clearing large maps of terrain. loading terrain is not an issue, as I have split the terrain in 2 and load it in separate times. for clearing, i would always use workspace.Terrain:Clear(). unfortunately, on some sizes of the terrain that is not a viable option, as it causes a complete crash to the script, causing an script exhaust/timeout. is there any safe way to clear this terrain without overloading the script?

jolly hollowBOT
#

studio** You are now Level 1! **studio

gray tendon
#

You may want to consider clearing the terrain in smaller chunks or sections, instead of all at once, and allowing the script to yield or wait in between each section. This way you can reduce the amount of memory and computation that is needed for each clear operation, and prevent a complete crash of the script. Additionally, you can implement a progress bar to show the user how much of the terrain has been cleared and prevent them from assuming the game has frozen.

neat anchor
#

i think you mean using coroutine.yield() right?

neat anchor
#

ohhhh i get it now

#

thank you man

#

also thanks for writing the code out for me, you really didnt have to do that haha

#

hey, i ran your code here through my game and it seems that there is an error with the y value. coroutine method works fine though