Hi,
I need to chose 1 terain from 5 and load it into workspace via script. Is it possible? If yes, how?
(and i also dont know how to save it, but this is not for this category)
Yep, it definitely is possible. What I’d do is keep 5 five different material enums inside an array, pick a random index and load it:
local terrains = {
Enum.Material.Grass,
Enum.Material.Sand,
--etc
}
workspace.Terrain:FillBlock(CFrame.new(0,0,0), Vector3.new(5,5,5), terrains[math.random(#terrains)])
You can read more about scripting terrain here
i think load terain by script (i have few maps, and i need to load them)
Ah I see, sadly unlike the Terrain editor you cannot load/save Terrain via a Script so instead you’ll need to use invisible parts to outline where your Terrain should go and create it.
so i need to create place for every terain (i will need match making, so i will need to teleport)
That is a viable method, it’d save you a lot of time.
Hold on a sec. There IS a way to save terrain and load it, as seen in this plugin. (By @Crazyman32)
You can view the source code of it once you install it, and that should help you figure out that problem.
any tutorial???
He goes into detail about how the plugin works here:
This post has developer hub pages you can use to make your own version. I’m not sure if there is a formal tutorial.