Problems positioning NPCS

I’m trying to position an NPC to a part’s position + an offset, but they always end up in the ground for some reason, no matter how much Y offset I add.

image

Code:

	local char = self.Character
	local hrp = char.HumanoidRootPart
	local hum: Humanoid = char.Humanoid
	
	local building = self.Building
	local heistFolder = building.Heist
	local enterZone = heistFolder.EnterZone
	
	print(enterZone.Position)
	hrp.Position = enterZone.Position + self.SpawnOffset --Currently adds 3 studs to the Y, but the position literally doesn't change even if I change it to 30 studs

image
The position of the NPCS

1 Like

You have to set a CFrame here instead of just setting the position of the humanoid root part, otherwise the entire NPC won’t move to the new position:

hrp.CFrame = CFrame.new(enterZone.Position + self.SpawnOffset)
char:PivotTo(enterZone.CFrame + CFrame.new(0,self.SpawnOffset,0)) -- enterZone:BasePart

If you use Pivot To and redirect to the target’s cframe, you can get exactly the desired result.

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