Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 4 years ago

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)
0
in game or in studio A_Mp5 222 — 4y
0
both?.. GarrettlovesGTA -1 — 4y
0
What do you mean both. That's a terrible answer. There is a big difference between those two. ElongatedMongoose 138 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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".

Ad

Answer this question