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

Check what smooth terrain material was clicked?

Asked by 8 years ago

Is there a way to check what smooth terrain material was clicked? (Localscript, Mouse)

If I do this: print(mouse.Target) it outputs: "Terrain"

1 answer

Log in to vote
0
Answered by 8 years ago

Figured it out myself.

    local region = Region3.new(vec3 - Vector3.new(2, 2, 2), vec3 + Vector3.new(2, 2, 2))
    region = region:ExpandToGrid(4)
    local material, occupancy = game.Workspace.Terrain:ReadVoxels(region, 4)
    print(material[2][2][2])
Ad

Answer this question