How do I get what part a player is standing on?

What I want to achieve:
I want to get what part a player is standing on.

What I’ve tried:
I’ve tried to ray cast down from the player’s leftfoot, rightfoot, and humanoidrootpart but it can miss the part the player is standing on when the player is standing on the edge of it.

Position and invisible part where you want and then use WorldRoot:GetPartsInPart

:GetTouchingParts()

https://developer.roblox.com/en-us/api-reference/function/BasePart/GetTouchingParts

Call this on the character’s leg/feet joints.

It works, but not when I walk. Is there a way to fix this?