Character Position Returning Incorrect Value

Hello. I’m having a pretty annoying issue with finding the position of the character. Upon loading into the game, my position is labeled by my script as [0,22,22] or some value near that. Checking my character’s position in the explorer window, however, yields a completely different result, being [633.904, 81.157, 1049.431], over 1000 studs away from where my script is claiming I am. The relevant code is shown below.

			print("ALLOWED")
			for _,Node in pairs(AI_WORK:FindFirstChild("AI_NODES"):GetChildren()) do
				for _,plr in pairs(game.Players:GetChildren()) do
					if plr and plr.Character and plr.Character:FindFirstChildOfClass("Humanoid") then
						print("FOUND PLR< CHECKING FOR DIST")
						local PLR_DIST = plr.Character:FindFirstChildOfClass("Part").Position
						print((Node.Position - PLR_DIST).Magnitude .. " PLR_DIST:" .. tostring(PLR_DIST))
						if ((Node.Position - PLR_DIST).Magnitude < 250) then
							print("Odd, DIST worked... no statements beyond this???")
							Rig:FindFirstChild("UpperTorso").CFrame = Node.CFrame + CFrame.new(0,10,0)
							Rig.Parent = AI_WORK:FindFirstChild("AI_GETLIST")
							print("SpawnNPC() END ALLOW")
							return Rig
						end
					end
				end
			end

This prints in console:

 19:39:31.373  FOUND PLR< CHECKING FOR DIST  -  Server - AIHandle:79
 19:39:31.373  1442.4455566406 PLR_DIST:0, 22.830015182495, 22.01000213623

I’m waiting for the character to load using the below:

local PLRCHECK = game.Players:FindFirstChildOfClass("Player") or game.Players.PlayerAdded:Wait()
local CHARCHECK = PLRCHECK.Character or PLRCHECK.CharacterAdded:Wait()
local PARTCHECK = CHARCHECK:FindFirstChildOfClass("Part") or CHARCHECK.ChildAdded:Wait()

I put that line in to see if it was something with loading, but it appears to not be.

Anyone know why this is happening? I think it’s an issue with roblox.

(This code is being fired from a module script.)

2 Likes