So I have a building system that allows you to build on Roblox terrain, but I don’t want players to build on terrain water. Is there a way to check the material of the terrain the player is trying to build on? This is what I have so far (not the full code just the relevant parts):
local function meetsPlacingRequirements(hit)
if hit then --in this case, hit == workspace.Terrain
--insert check for terrain material
end
end
local function handleRenderStepped()
if placingStructure and clientStructure then
local mouseRay = mouse.UnitRay;
local castRay = Ray.new(mouseRay.Origin, mouseRay.Direction * 1000);
local ignoreList = {clientStructure, character};
local hit, position = workspace:FindPartOnRayWithIgnoreList(castRay, ignoreList);
if meetsPlacingRequirements(hit) then
setPlacingStatus(true);
else
setPlacingStatus(false);
end
end
end