Generate a cave system under your terrain and export a script that carves it for real.
A heightmap can only ever describe one elevation per point - bright is high, dark is low - which makes it mathematically incapable of a tunnel with rock above it. Real Roblox terrain is a true 3D voxel volume underneath, though, and there's a real API for carving it. This generates a network of tunnels, lets you place entrances, previews them in 3D against your terrain, and exports a script that carves them for real with Terrain:FillBall().
Why a script, not an image. "A cave is a ball of Air inside a hill, and a tunnel is a row of them" is how Roblox's own docs put it. The export is a compact table of dig points plus a short loop - paste it into a Script, run it once after importing the matching heightmap, then delete it.
A colormap is optional too - if you provide one, random entrances avoid starting underwater.
Click the map to add one, right-click to remove the nearest.
Optionally forces the rock around each tunnel to one material before carving the Air core - useful for a lava tube's basalt walls even through a grassy hill.
This shows your imported colormap (or heightmap, or a flat placeholder). Click to add an entrance, right-click to remove the nearest one.
Drag to orbit, scroll to zoom. Each sphere is one FillBall call - this is what actually gets carved, not a smoothed approximation of it. Orange rings mark entrances; darker spheres are branch tunnels.