Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can i replace a terrain material(grass) with another (snow) all over my map?

Right now, I have all grass as terrain but I want to convert all of it to snow without painting it slowly so I found this script tot change it but I'm not sure how to make this convert all the grass on the entire map.

local min = Vector3.new(-20, -20, -20)
local max = Vector3.new(20, 20, 20)
local materialToReplace = Enum.Material.Grass
local replacementMaterial = Enum.Material.Snow
 
workspace.Terrain:ReplaceMaterial(Region3.new(min, max), 4, materialToReplace, replacementMaterial)

3 comments

0

in game or in studio

0

both?..

0

What do you mean both. That's a terrible answer. There is a big difference between those two.

1 answer

✓ Accepted answer

I got it to work, like this:

local center = Vector3.new(0, 0, 0)
local size = Vector3.new(500, 500, 500)
local materialToReplace = Enum.Material.Grass
local replacementMaterial = Enum.Material.Snow
 
workspace.Terrain:ReplaceMaterial(Region3.new(center, size), 4, materialToReplace, replacementMaterial)

the Region3.new() function first argument is the center of the region, and the second argument is the size of the region.

Also, you can already do what this script does inside studio. inside the terrain editor window, go to the edit tab, and select "Replace".

This discussion is preserved as it was. New answers, comments, and votes are closed.