2 Different Outputs when Printing the Same Thing?

Hi Guys,

I just want to start off by saying that I am very new to scripting and still learning a lot everyday. That is actually why I am making this post, as I have ran into something that I cannot understand, and am hoping that someone can explain it to me.

Basically, I have a local script inside an NPC. I want to check the position of this NPC for use in further code later in the script.

To do this, I have tried two ways.

  1. Defining the HumanoidRootPart like this
    local Root = workspace.NPCs.Feugazi.HumanoidRootPart

  2. Defining the HumanoidRootPart like this
    local RootTest = script.Parent.HumanoidRootPart

I then add print(RootTest.Position) and print(Root.Position) to the script and this is the output
image

Can anyone explain why I am getting two different position for the same object?

Are you printing it while the NPC is standing still? Which one is being printed first?

Is the script that uses the Workspace directory a server script? If so the server and client may have different positions on where the NPC is, potentially from another client sided script changing its position.

Yes I am printing 2 seconds after loading into Studio Test and the NPC is standing still.

print(RootTest.Position) is first