How do I randomly place stuff on roblox terrain

Im talking the actual terrain, I dont really want to use actual parts and then go from there

2 Likes

I have been pondering this for the past several months. I don’t know the answer but I am certainly excited to hear it!

yeah wither i dont think well both ever find out ;-;

2 Likes

@IProgramForFun
I FIGURED IT OUT!!!
If you look on the page that resolved your last post you can see that you can use Region3s to generate terrain!
EX:

    local region = Region3.new(Vector3.new(0,0,-3), Vector3.new(4,4,4))
    region = region:ExpandToGrid(4)
    game.Workspace.Terrain:FillRegion(region, 4, Enum.Material.Slate)

Result:
YAY

(The function is Terrain:FillRegion)

1 Like

yeah but thats not what Im trying to do though, but its fine ill figure something out ^^

I am confused. What are you looking to achieve?

I basically wanted to place stuff randomly on the terrain, but not terrain LOL

1 Like

Oh you mean like trees and rocks. I will get right on it!

dude no you dont have to do anything

1 Like

Raycast down on the terrain and put the object where the raycast hits the terrain

1 Like

I was trying to do this earlier. It is a nightmare because you have to cast in a lot of places and it causes a lot of lag.

Expanding upon what @heII_ish said I think you should measure the x and z axis and reference them in a script, then you can use a math.random function to choose a random number between the length of the x axis and do the same for the z. Next, you raycast from that point by using workspace:Raycast (I don’t know how to use the old one) you check where the ray hit and place a tree there!