0
\$\begingroup\$

I am stopping a moving player model in its tracks and would like to get its position.

Here is my test:

 target.HumanoidRootPart.Anchored = true target.Humanoid.PlatformStand = true while wait(5) do  print('v1 => ' .. tostring(target:GetPrimaryPartCFrame().Position))  print('v2 => ' .. tostring(target.HumanoidRootPart.CFrame.Position))  print('v3 => ' .. tostring(target.HumanoidRootPart.Position))  print('v4 => ' .. tostring(target.HumanoidRootPart:GetRenderCFrame().Position)) end 
All four debug msgs agree on the target's position and never change. However, the position they agree on is incorrect. This can be verified in studio testing, under explorer, player model, humanoidrootpart, properties -> Position.

While this is obviously related to the model's movement prior to this test method running, I am at a loss as to how I can retrieve the real position once the model is anchored.

I also tried removing the anchor and moving the model to verify that the position updates. And it does. So I know that I'm looking at the correct and updated instance.

How is it possible that these positions do not match?

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

The root problem is that the client and server are out of sync. Printing the position from a local client script shows the same position as the studio explorer. The server is not updating

The reason for this drift appears related to my use of anchoring and how that affects replication. This 2019 discussion brings up a few topics that I will look into:

https://devforum.roblox.com/t/cframe-not-replicating-while-character-is-anchored/247019/9

\$\endgroup\$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.