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

How to find the Position between leftfoot and rightfoot?

Asked by 2 years ago

I am trying to find the Position between the leftfoot and rightfoot how is this cauclated?

Reason Why I need this

I am teleporting a character onto a very thin platform which if I teleported onto the thin platform there's a chance I fall whenever I use :SetPrimaryPartCFrame on an humanoidrootpart

I need to find the position of leftfoot and right foot to avoid this

I also need the character to be on the middle which is why I need the position between leftfoot and rightfoot

2 answers

Log in to vote
0
Answered by 2 years ago

I'd recommend doing

player.Character.HumanoidRootPart.CFrame = CFrame.new(--the place you want to teleport them)

That should work:)

Ad
Log in to vote
0
Answered by
Xapelize 2658 Moderation Voter Community Moderator
2 years ago

If you want to calculate the position between Left Foot and Right Foot, you can use the formula:

(LeftFoot.Position + RightFoot.Position) / 2

But, it is not recommended to do that using teleports. Because you cannot get the height of the leg, so you still get bugged either.

It is recommend to do this:

-- This is a LocalScript

local player = game.Players.LocalPlayer
local char = player.Character

char:FindFirstChild("HumanoidRootPart").CFrame = CFrame.new(0,0,0)

Why HumanoidRootPart? It is because HumanoidRootPart is the only instance in player character that exists in R6 and R15, meaning that you can teleport anyone to anywhere using the method.

But if you really really really want to get the position between LeftFoot and RightFoot, since in R15 there is "UpperRightLeg", "UpperLeftLeg" and more... So if you want to do that method, it depends on your Rig Type.

Answer this question