How do i make chunk loading system

i wanted to make a infinite game
i cant because it will lag and lot of problems
i didnt found anything for that can anyone help

i am making a game that is infinite randomly generated so if i make it infinite it will lag and studio crash
but i know theres is weays like minecraft’s chunk loading



Wait for assets to load? Try using ContentProvider.
For example:

local contentprovider = game:GetService("ContentProvider")
local assets = { game.Workspace.Sound, game.Workspace.Part } -- All of your assets must be in here.
1 Like

Yea, its better to make a folder of important assets like Sounds,Images and then loop through the table and preload them. Also you shouldn’t be preloading the whole game like parts.


I once saw a tutorial about a infinite terrain generator, and it had a chunk loading system. You could try learning from it and implement your own version of it, since hands on are way better than “Hippity hoppity your code is now my property”.


You can create a chunk then make a part in the middle of the chunk, and unload it when the character is far away enough, you can do this using magnitude.


i mean is roblox have any way to enable disable part surfaces? or its just with content provider?

You could just loop through your chunk and disable all of the part surfaces.

1 Like

Have you looked at Workspace.StreamingEnabled (

This streams in and out radius locations around a network focus.

is it possible to disable them?? how?

I’m confused. Isn’t that the entire point of creating a general loading system?

No, stuff like images and sounds are most important to preload. For example a Sniper Scope’s image might not load as fast so its important to preload them. Parts are already loaded and don’t really need preloading tbh.

1 Like

I made an infinite terrain system and yes it does eat up the memory really fast. However what I did is I took a radius approach, math is cheap but basically each chunk has a middle point and 4 corners right. With some modified AABB math if the player is x distance to an edge it will create a new chunk from that edge plus the middle point position we talked about. Then this isn’t how I made mine but i’m simplifying it for you all of the middle points and corners and chunks are saved as a dictionary. In each heartbeat it does a magnitude check for every middle point. If the middle point is x amount away, then I want to “despawn” them. Now what I would do then if I wanted to despawn it is since I got a perline seed I don’t need to remember anything, it a pure function. I would create a voxel square with some aabb logic and the corners (see here) image

Then I would get the min and max verticies (see here) then create a region 3 from that. I would then get rid of all the baseparts of the region 3 by destroying them (on the client) while ignoring important stuff (commonly grouped in folders). From there I would just reset the cell center to world and cell and to world and call terrain:Clear()