Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Check what smooth terrain material was clicked?

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

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])

This discussion is preserved as it was. New answers, comments, and votes are closed.