I have been thinking about adding sound to terrain e.g. when you walk on grass play grass effect, when you walk on snow play snow effect.
I cannot seem to find a way of getting the terrain material, e.g. grass or ice.
Here is what I have been working with:- this just adds an touched event to a characters leg
local srvSorage = game:GetService("ServerStorage")
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
wait(1)
local cln = srvSorage.touch:Clone()
cln.Parent = character:FindFirstChild("Left Leg")
end)
end)
The touched event script
script.Parent.Touched:connect(function(part)
if part:IsA("Terrain") then
print("TerrainFound")
print(part.ClassName)
end
end)
output:- TerrainFound Terrain
I have seenReadVoxels but this seems like a long way around to just get the terrain material.
Edit:- If possible this would need to be ran on a local script.
