How to detect other materials with FloorMaterial

Hello. Im wondering is there a way to detect other materials with humanoid FloorMaterial like detecting: Ground, Asphalt, Basalt, etc im working on a walking sound effect and im stuck at this part also is there a way to create a Custom floor material detector?
(So Sorry for bad grammar)

2 Likes

Humanoid.FloorMaterial returns an Enum data type which you can check which material is player standing on. That function also works on terrains too.

Here is an example code:

local humanoid = path_to_humanoid

humanoid:GetPropertyChangedSignal("FloorMaterial"):Connect(function()
    print(humanoid.FloorMaterial)
end)

This code works automatically when you written this on a script and placed that script to StarterPlayer > StarterCharacterScripts.

Here is some documentation:

2 Likes