Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to get the y elevention of the floor a player is standing on?

Asked by
asadefa 55
4 years ago

I am trying to create a part right at the player's foot. The part is very thin. My question is how do I get the y position right where the players feet touch the floor, based on the HumanoidRootPart's position. What I have tried is subtracting 3, and this sometimes works, but it will act weird if there is an r6 avatar or a different body scale. What is the reliable way to get the Y position of the bottom of a player's collision box, so that I can create a part right at their feet?

1
use an if statement to determine what the avatar type is RobloxianDestory 262 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Hm. A good place to start is:

local leg = char:FindFirstChild(“Right Leg”)
local elevation = leg.Position.Y - leg.Size.Y/2

This would work for r6 obviously. You can do the same with bottom left leg in r15, so you just need to detect it. Like what @RobloxianDestory said, you need an if statement to detect if a character is in r6, or r15, then use the snippet above to find the bottom of a character’s leg using scale.

Ad

Answer this question