Use TerrainHeight() instead of TerrainY.
Don't forget to multiply the result by whatever you scaled the terrain by on the Y axis, since TerrainHeight returns a float between 0 and 1.
Don't forget to multiply the result by whatever you scaled the terrain by on the Y axis, since TerrainHeight returns a float between 0 and 1.