Cant get HumanoidRootPart magitude after teleporting character

after i teleport the character to another position, move it into a folder and do player:LoadCharacter() it doesnt do ShopGui.Visible = true
(it does work before i do all of that)

local RunService = game:GetService(“RunService”)
local Players = game:GetService(“Players”)

local player = Players.LocalPlayer

local ShopZone = game.Workspace:WaitForChild(“shop”):WaitForChild(“ShopZone”)
local ShopGui = player.PlayerGui:WaitForChild(“ShopGui”):WaitForChild(“ShopFrame”)

RunService.Heartbeat:Connect(function()
local character = player.Character or player.CharacterAdded:Wait()
local HumanoidRootPart = character:WaitForChild(“HumanoidRootPart”)
if HumanoidRootPart then
local distance = (HumanoidRootPart.Position - ShopZone.Position).Magnitude
print(distance)

  if distance < 20 and ShopGui.Visible == false then
  	print(HumanoidRootPart)
  	ShopGui.Visible = true
  end

end
end)

Did this line print out when you playtest the code?

only before i teleported the character and all of that