Is there any way to detect which terrain material the player is stepping on?

Good as it is in the Title I would like to know if there is any way to detect the Terrain Material that the player is stepping on

The humanoid has a property called FloorMaterial. It works with terrain materials as well.

5 Likes

I just tested and it doesn’t seem to work with all materials

Well, it should, can you show us a video of it not behaving as needed?

1 Like

https://cdn.discordapp.com/attachments/407765631518244865/640619490157264897/save.gif

@0_1195 's post should work for you. Are you properly listening to the changes made on FloorMaterial?

local Humanoid = route.to.humanoid

Humanoid:GetPropertyChangedSignal("FloorMaterial"):Connect(function()
    print("New value for FloorMaterial: " .. Humanoid.FloorMaterial)
end)
1 Like

Yeah as @AbiZinho said! I assume the property doesn’t change on the properties tab but if you print it

print(humanoid.FloorMaterial)

It would print it

1 Like

This is a little off-topic, but does anyone know how to detect terrain material using a ray?

:FindPartOnRay() doesn’t actually return just the part that it hit, and the exact location where it hit, it actually returns other values.

It returns the Material of the part that hit as a 4th value.

local _, __, ___, material = workspace:FindPartOnRay(ray)
print(material)
1 Like

Hey, thanks man! I tested it through the console thingy real quick, but it’s the 4th value, the 3rd one is surface normal :V

1 Like

Oh yeah sorry my bad I misstyped