im guessing i use mouse.Target but when i print it, it just says “Terrain” not “Rock” or “Grass” or anything like that
I am not sure if the mouse object has any property for determining the material of the target, so you will probably need to raycast yourself instead. The RaycastResult object that is returned after raycasting using the “Raycast” method in workspace has a “Material” property.
Try raycasting.
-- i dont know that much about raycasting so this may not work
local ray = mouse.UnitRay
local result = workspace:Raycast(ray.Origin, ray.Direction * 150)
if result and result.Instance == workspace.Terrain then
print('player mouse is on terrain | material:', result.Material)
end
1 Like