HumanoidRootPart position not changing after player has respawned

  1. What do you want to achieve? Keep it simple and clear!
    I am making a script where an npc follows the player based on the distance between the npc and the player’s hrp
  2. What is the issue? Include screenshots / videos if possible!
local hrp = character.HumanoidRootPart.CFrame.Position
	local aihrp = ai.Parent.HumanoidRootPart.CFrame.Position
	dist = (hrp - aihrp).Magnitude

the code is under a while loop so it should update it, printing the hrp position seems normal but after the player resets/respawned the hrp position stays at the place where the player has died.

i have looked everywhere for a solution but i cant seem to find the right answer.

You must update the variable that contain the character’s model. I don’t know how you obtain the player’s character in your code but put this variable in your loop.

If that doesn’t work, maybe show us more code and explain if it’s a Script or a LocalScript.

1 Like

Thank you so much! i have been trying to solve this for a few hours now.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.