Chunks remove when playing is to far away from it

So I wanted to make a game with map generation but I didn’t want to lag the player all at once and I know a way to do this was removing Chunks when the player is to far from the Chunk.

I don’t know anything about Terrain execpt perlin noise and I want to combine those scripts toeghter so the player can have less of a laggy expirence when playing

You could put chunks into very tall parts and then putting all the content of the chunk inside a folder in the chunk part, also having an object value linked to the folder would be good. A local script checks if the player’s character’s x and z coordinates are close enough (using magnitude or something) and then loads them in using the object value.

When the player is too far away the folder is stored in server storage or some random thing idk until it is ready to get loaded in.

Using transparency for closer chunks so that they load in smoother could work too.


Thank you cause I was gonna do something like if you get closer to a chunk then that chunk would like slide up and the chunk thats getting deleted would slide down