Can someone help me with allign pos, i made an npc with non humanoid with it but now its floating for some reason

Hi im CTG i need help with this allign pos non humanoid character, It kept floating for some reason, i’ve been struggling to fix it for the past few hours, if someone’s familiar with this i need your help
SieuNhanZombie
^^

function mob.Move(newMob, EnemyConfig, Path)
	local Health = EnemyConfig:FindFirstChild("Health")
	local Map = workspace.Map:FindFirstChildOfClass("Folder")

	local EnemyRoot = newMob:WaitForChild("HumanoidRootPart")
	local EnemyPosition = EnemyRoot:WaitForChild("AlignPosition")
	local EnemyOrientation = EnemyRoot:WaitForChild("AlignOrientation")
	
	local NextPath = newMob:FindFirstChild("MovingTo").Value
	
	while true do
		if Health and Health.Value <= 0 then
			break
		end

		if (EnemyRoot.Point.WorldPosition - Path[NextPath].Point.WorldPosition).Magnitude < 1 then
			if NextPath < #Path:GetChildren() then
				NextPath = NextPath + 1
				newMob:FindFirstChild("MovingTo").Value += 1
			else
				break
			end
		else
			EnemyPosition.Attachment1 = Path[NextPath].Point
			EnemyPosition.MaxVelocity = EnemyConfig.Speed.Value
			--EnemyOrientation.Attachment1 = Path[NextPath].Point
			EnemyRoot.CFrame = CFrame.new(EnemyRoot.Position, Vector3.new(Path[NextPath].Position.X, EnemyRoot.Position.Y, Path[NextPath].Position.Z))
			
		end

		if Health and Health.Value <= 0 then
			break
		end

		task.wait()
	end

	if NextPath == 29 and Map.Name == "Castle" or NextPath == 22 and Map.Name == "Lang Bac" or NextPath == 13 and Map.Name == "Grassland" then
		newMob:Destroy()
		Map.Base.Humanoid:TakeDamage(Health.Value) 
	else
		local DeathEffect = script.Parent.DeathEffect:Clone()
		local DeathEffect1 = DeathEffect.MainAttachment.Chunks
		local DeathEffect2 = DeathEffect.MainAttachment.Chunks2
		DeathEffect.Parent = workspace.Bullet
		DeathEffect.CFrame = newMob.HumanoidRootPart.CFrame
		local mobColor = ColorSequence.new(newMob.Head.Color)
		DeathEffect1.Color = mobColor
		DeathEffect2.Color = mobColor
		wait(0.01)
		newMob:Destroy()
		wait(0.75)
		DeathEffect:Destroy()
	end
end
1 Like

Have you tried using tween to move the model via cframe instead of using align position?