How can paint an certain area (position, size, material) using script, similarly to ?
I tried the following:
workspace.Terrain:FillBlock(CFrame(), Vector3.new(), Enum.Material.Grass)
But it fills, unless I can somehow use it to paint…
How can paint an certain area (position, size, material) using script, similarly to ?
I tried the following:
workspace.Terrain:FillBlock(CFrame(), Vector3.new(), Enum.Material.Grass)
But it fills, unless I can somehow use it to paint…
If you want to paint area to any color, yes! But if you want other material of part, that means - i can’t answer
If your goal is to make it appear when something happens, try making parts of it visible and can collideable at certain times, but have the terrain all painted beforehand.
This is what I want to do but using script:
→
Basically replace material in size and position of the part.
Then yes, I do think you should be able to just remove a very small section using script.
Or add, sorry (30 characterssss)
But how? How you want me to do it? Using the :FillBlock()
Method?
I tried to do it with :FillBlock()
but it fills instead of replacing.
I do believe that’s how it works. I didn’t even know that scripts could edit terrain at all. Try something like this:
if whatevervariable then
Terrain location that you want:FillBlock()
Oh, never mind. You should try something like this:
if whatevervariable then
Terrain location that you want.TerrainType = dirt
There could be 5 million errors in that script, I have no idea. I hope it helped tho.
You could try using :FillRegion() instead.
How I could use it in this situation?
Oh wait actually nevermind, The only way is changing the material of it or changing the color of the material.
So how terrain tools’s paint feature works then?
It switches a material with other… (I think I still didnt understand your question)
Here I explained what I wanted to do.
Oh wait I think I found the solution for this.
Go down to the Functions and there will have ReplaceMaterial.
You can see how Roblox does it, check their GitHub:
Ok, thank you.
workspace.Terrain:ReplaceMaterial(Region3.new(min, max), 4, materialToReplace, replacementMaterial)
One more question, how I create Region3.new()
with size and position?
Actually you dont need to do Size and Position, Region3.new() returns a region from the minimum to the maximum
Let’s say there is a point at 0,0,0 and other at 10,10,10. When you create a Region3.new() that has the 0,0,0 at minimum and 10,10,10 as maximum it will create a region that is inside that.
Meaning that it has a size and stays at the position between these.