Help with changing terrain color with a Script?

There is a way to change and read terrain colours but it needs to be done with a function, you cannot directly write to it. SetMaterialColor will get the job done for you. Likewise, of course, it has a Get function as well so that you can tell what the current colour of a material is.

11 Likes

To add onto what @colbert2677 has said, it is definitely possible to read and write the colors of terrain.
To read you would use the function: Terrain:GetMaterialColor(material)
To write you would use the function: Terrain:SetMaterialColor(material, Color3)

Example code:

local Terrain = game:GetService("Workspace").Terrain

--Gets the material color of the terrain material in question
local GetColor = Terrain:GetMaterialColor(Enum.Material.Grass)

print(GetColor) --Outputs the color of the terrain material

--Sets the material color of the terrain material in question
local SetColor = Terrain:SetMaterialColor(Enum.Material.Grass, Color3.fromRGB(0,180,255))

Hope this helped!

(I withdrew my previous post to reply to OP :slight_smile: )

21 Likes