Replicating Terrain to Client?

I’m looking for a way to replicate predesigned terrain to the Client -
The reason for this is essentially a chunk / area system. So when the Player enters a new area the required terrain will load and others will clear - Only having 1 chunk visible at any given time.

Is there any method for serialising Terrain to a ModuleScript and then rendering from that? Open too all concepts and suggestions!

Thank yoy

You can use the TerrainRegion object, but I wouldn’t store it on the server and then fire a remote to the client any time they approach a chunk. Just store a bunch of them in ReplicatedStorage.

1 Like

If it’s infinite, you can just generate the terrain on the client aslong the seed is stored in some NumberValue/IntValue or Attribute set by the server. This will generate the same terrain on all clients without the server doing the work.

1 Like

I’m looking to build Terrain itself - The chunks only load when the Player teleports to them, i.e. going to a new area, it then loads in and the player is located to that region until they travel elsewhere.

@NPCPlayer2421 Won’t be infinite, it’ll be prebuilt. But unsure how I would go about saving it and loading it in?

Use the TerrainRegion object. It stores terrain data about a given region. Use the CopyRegion function of the Terrain object in workspace, it’ll give you a TerrainRegion object. If you use the PasteRegion function of the Terrain object and pass in this TerrainRegion object and a position it’ll be pasted there… this is how you save and load terrain chunks.

1 Like

Would that work for a Client based Terrain though as to my understanding you cannot directly replicate it.

Make an array, each entry containing information about position and material, then load it in appropriately on the client

That just means you cannot send a TerrainRegion object through a RemoteEvent from the server to the client and vice versa.

If you create the TerrainRegions and put them in ReplicatedStorage for example, the client should be able to access them just fine. You just can’t send it through a RemoteEvent. If it’s prebuilt create them in edit mode and put them in a container that the client can see.

1 Like

Hi sorry to necrobump.

I’ve just come back to this project however this hasn’t worked; I have TerrainRegions stored in ReplicatedStorage that were created / saved through a Plugin.

I’m able to load the Terrain from a Server script however not from a Local.